WIP: Introduce bash scripting unittests #724
Reference in New Issue
Block a user
Delete Branch "justusbunsi/bats-shell-testing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description of the change
This adds an environment for unit testing our bash scripts, using BATS.
It implements first tests for
config_environment.sh.Benefits
Writing unit tests for bash scripts documents the expected behavior and allows it being a quality gate in our CI.
Possible drawbacks
Not everyone is familiar with this approach and unit testing framework. Me neither, it took me some hours to get into it.
Applicable issues
config_environment.shwas detected. It doesn't fixes it yet. This will be a dedicated Pull Request.Additional information
I had to extract the bash script into an actual
.shfile. Therefore, thetoken.shscript from the act_runner Pull Request had to be moved into its own subfolder.To better distinguish between Helm unittests and Bash unittests, all Helm unittests are moved into their own subfolder.
💡 Since the diff is very large, reviewing each commit might be better. I made atomic commits.
🤔 Making the tests pass in the CI is something for another day...
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.