2019-08-01 12:43:42 +00:00
|
|
|
# System tests
|
|
|
|
|
2020-07-27 13:35:17 +00:00
|
|
|
These tests are built with BATS (Bash Automated Testing System).
|
2019-08-01 12:43:42 +00:00
|
|
|
|
2020-02-18 12:17:53 +00:00
|
|
|
The tests are meant to ensure that Toolbox's functionality remains stable
|
2019-08-01 12:43:42 +00:00
|
|
|
throughout updates of both Toolbox and Podman/libpod.
|
|
|
|
|
2020-07-27 13:35:17 +00:00
|
|
|
**Warning**: The tests are not executed in an isolated environment. They affect
|
|
|
|
the system where they are run.
|
|
|
|
|
|
|
|
## Dependencies
|
|
|
|
|
|
|
|
These tests use a few standard libraries for BATS which help with clarity
|
|
|
|
and consistency. In order to use it you need to download them to the `libs`
|
|
|
|
directory:
|
|
|
|
|
|
|
|
```
|
|
|
|
# Go to the Toolbox root folder
|
|
|
|
$ git clone https://github.com/ztombol/bats-assert test/system/libs/bats-assert
|
|
|
|
$ git clone https://github.com/ztombol/bats-support test/system/libs/bats-support
|
|
|
|
```
|
2019-08-01 12:43:42 +00:00
|
|
|
|
|
|
|
## Convention
|
|
|
|
|
2020-07-27 13:35:17 +00:00
|
|
|
- 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
|
2019-08-01 12:43:42 +00:00
|
|
|
|
2020-07-27 13:35:17 +00:00
|
|
|
Examples:
|
2019-08-01 12:43:42 +00:00
|
|
|
|
2020-07-27 13:35:17 +00:00
|
|
|
* `@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()` and `teardown()` functions for that purpose.
|
|
|
|
|
|
|
|
## How to run the tests
|
2019-08-01 12:43:42 +00:00
|
|
|
|
2020-07-27 13:35:17 +00:00
|
|
|
Make sure you have `bats`, `podman` and `toolbox` installed on your system. And
|
|
|
|
have the test dependencies prepared.
|
2020-02-10 15:16:36 +00:00
|
|
|
|
2019-08-01 12:43:42 +00:00
|
|
|
- Enter the toolbox root folder
|
|
|
|
- Invoke command `bats ./test/system/` and the test suite should fire up
|
|
|
|
|
|
|
|
By default the test suite uses the system versions of `podman` and `toolbox`.
|
|
|
|
|
|
|
|
If you have a `podman` or `toolbox` installed in a nonstandard location then
|
|
|
|
you can use the `PODMAN` and `TOOLBOX` environmental variables to set the path
|
|
|
|
to the binaries. So the command to invoke the test suite could look something
|
2020-07-27 13:35:17 +00:00
|
|
|
like this: `PODMAN=/usr/libexec/podman TOOLBOX=./toolbox bats ./test/system/`.
|