Majority of the configuration options are covered by end-to-end tests. The tests are utilizing shellspec framework. A quick installation of shellspec
can be done by curl -fsSL https://git.io/shellspec | sh
. See their website for more installation options.
The tests will create a local registry, testing images, and services. Testing images are pushed to the local registry, therefore no external registry is needed. Then the tests will run Gantry to update these services.
Use the following commands to run all the tests locally. The tests run Gantry scripts on the host, but it should not affect any running docker swarm services on the host.
bash shellspec
To run only selected tests
# Filter tests by name.
bash shellspec --example <example_name>
# Run tests within a file.
bash shellspec --pattern tests/<file_name>
# Or combination of both
bash shellspec --pattern tests/<file_name> --example <example_within_the_file>
To run multiple tests in parallel
bash shellspec --jobs 50
To generate coverage (require kcov installed):
bash shellspec --kcov
The above commands test Gantry as a script running on the host directly. We also want to test Gantry running inside a container in case the environments are different between the host and the container.
To test Gantry running inside a container, set the environment variable GANTRY_TEST_CONTAINER
to true
. The testing framework will build a local image of Gantry, then start a service of that image to run the test.
export GANTRY_TEST_CONTAINER=true
bash shellspec --jobs 50
If you want to test a specific image of Gantry, you need to set the image of Gantry explicitly via the environment variable GANTRY_TEST_CONTAINER_REPO_TAG
.
export GANTRY_TEST_CONTAINER_REPO_TAG=<gantry image>:<tag>
bash shellspec --jobs 50