Use BATS for image testing#802
Merged
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This switches the current tests to the BATS testing framework:
https://github.com/bats-core/bats-core
Longer term this will allow us to add more sophisticated tests for the images using a TAP-compliant testing framework. Eventually we can start introducing some more basic tests for Node as well as npm and yarn. The Travis-Ci build instances have BATS preinstalled and it defaults to showing the results in TAP format, which might be useful.
I've been wanting to do this for a while but it wasn't until I was working on a proposal/branch for the "core" variant (the node image without yarn or npm) that I decided to finally take this on. I needed a way to skip the npm and yarn tests for the "core" image which meant I would have to make significant changes to the current
test-image.shapproach. Given the effort involved to do that, it seemed like a good opportunity to try BATS since it already provides a way to skip tests conditionally: https://github.com/bats-core/bats-core#skip-easily-skip-testsAlso note that in this PR I'm changing how we run the tests. Previously the tests were run by mounting the
test-image.shscript in the target container. In order to work with the Alpine image each test is now run as a part of adocker runcommand. I also did a bit of refactoring and added some new functions.