This allows to run the test suite without having to worry about blasting the whole local state of Podman. This is done by creating a configuration file with a custom path for the storage of Podman and specifying the config file using an env var. The used location for the temporary storage is located either under XDG_CACHE_HOME and if the one is not defined, $HOME/.cache is used instead. The data are namespaced. This follows the XDG Base Directory Specification[0]. Other locations could be /tmp or /run but those locations usually use tmpfs and that filesystem can not be used by Podman[1] due to missing features in tmpfs. https://github.com/containers/toolbox/pull/818 [0] https://specifications.freedesktop.org/basedir-spec/latest/index.html [1] https://github.com/containers/podman/issues/10693#issuecomment-863007516 |
||
|---|---|---|
| .. | ||
| libs | ||
| 000-setup.bats | ||
| 001-version.bats | ||
| 002-help.bats | ||
| 100-root.bats | ||
| 101-create.bats | ||
| 102-list.bats | ||
| 103-container.bats | ||
| 104-run.bats | ||
| 105-enter.bats | ||
| 106-rm.bats | ||
| 107-rmi.bats | ||
| 999-teardown.bats | ||
| README.md | ||
README.md
System tests
These tests are built with BATS (Bash Automated Testing System).
The tests are meant to ensure that Toolbox's functionality remains stable throughout updates of both Toolbox and Podman/libpod.
The tests are set up in a way that does not affect the host environment. Running them won't remove any existing containers or images.
Dependencies
awkbatsGNU coreutilspodmanskopeotoolbox
These tests use a few standard libraries for bats which help with clarity
and consistency. The libraries are bats-support
and bats-assert. These libraries are
provided as git submodules in the libs directory. Make sure both are present.
Convention
- All tests should follow the nomenclature:
[command]: <test description>... - When the test is expected to fail, start the test description with "Try to..."
- When the test is to give a non obvious output, it should be put in parenthesis at the end of the title
Examples:
@test "create: Create the default container"@test "rm: Try to remove a non-existent container"
- All the tests start with a clean system (no images or containers) to make sure
that there are no dependencies between tests and they are really isolated. Use
the
setup()andteardown()functions for that purpose.
How to run the tests
First, make sure you have all the dependencies installed.
- Enter the toolbox root folder
- Invoke command
bats ./test/system/and the test suite should fire up
Mocking of images is done automatically to prevent potential networking issues and to speed up the cases.
By default the test suite uses the system versions of podman, skopeo and
toolbox.
If you have a podman, skopeo or toolbox installed in a nonstandard
location then you can use the PODMAN, SKOPEO and TOOLBOX environmental
variables to set the path to the binaries. So the command to invoke the test
suite could look something like this: PODMAN=/usr/libexec/podman TOOLBOX=./toolbox bats ./test/system/.
When running the tests, make sure the test suite: [job] jobs are successful.
These jobs set up the whole environment and are a strict requirement for other
jobs to run correctly.