toolbox/test/system
Debarshi Ray e1635c06f3 Make locate(1) work inside toolbox containers
... by running updatedb(8) on start-up and then at 24 hour intervals
from there on.

This isn't as nice as using a systemd.timer(5) because the current
timer goes away when the toolbox container is stopped and is rearmed
when it's started. Therefore, repeatedly restarting a container will
also run updatedb(8) again and again.

Fortunately, this isn't so bad with updatedb(5) implementations that
are able to incrementally update the database [1], which is what Fedora
uses.

The 24 hour interval was chosen based on the systemd.timer(5) settings
used by Fedora's mlocate RPM.

[1] https://pagure.io/mlocate

https://github.com/containers/toolbox/issues/391
2020-11-03 01:41:41 +01:00
..
001-version.bats playbooks, test/system: Test the Go implementation and update tests 2020-07-21 16:31:50 +02:00
002-help.bats playbooks, test/system: Test the Go implementation and update tests 2020-07-21 16:31:50 +02:00
101-list.bats test/system: Rework the tests 2020-02-18 14:00:59 +01:00
102-create.bats playbooks, test/system: Test the Go implementation and update tests 2020-07-21 16:31:50 +02:00
103-list.bats playbooks, test/system: Test the Go implementation and update tests 2020-07-21 16:31:50 +02:00
201-run.bats test/system: Rework check if toolbox started successfully 2020-10-24 17:32:15 +02:00
301-rm.bats playbooks, test/system: Test the Go implementation and update tests 2020-07-21 16:31:50 +02:00
302-rmi.bats test/system: Rework the tests 2020-02-18 14:00:59 +01:00
helpers.bash Make locate(1) work inside toolbox containers 2020-11-03 01:41:41 +01:00
README.md test/system: Rework the tests 2020-02-18 14:00:59 +01:00

System tests

These tests are built with BATS (Bash Automated Testing System). They are strongly influenced by the libpod project.

The tests are meant to ensure that Toolbox's functionality remains stable throughout updates of both Toolbox and Podman/libpod.

Structure

  • 0xx (Info)
    • Commands that are not dependent on the presence/number of containers or images. eg., version, help, etc..
  • 1xx (Initialization)
    • Commands (list, create) when Toolbox has not really been used, yet.
    • It tries to list an empty list, creates several containers (default one and several with custom names and images).
  • 2xx (Usage)
    • The created containers are used for the first time testing the initialization (CMD of the container).
    • Not all containers will be used because in the Cleanup phase we want to try removing containers in both running and not running states.
  • 3xx (Cleanup)
    • In this section the containers and images from the previous phases are removed.
    • There is a difference between removing running and not running containers. We need to check the right behaviour.

Convention

  • All tests that start with Try to.. expect non-zero return value.

How to run the tests

Make sure you have bats and podman with toolbox installed on your system.

Important Before you start the tests, you need to have present two images: the default fedora-toolbox image for your version of Fedora and the fedora-toolbox:29 image.

  • 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 like this: PODMAN=/usr/libexec/podman TOOLBOX=./toolbox bats ./test/system/.