toolbox/test/system
Debarshi Ray 411147988b cmd, test/system: Make the behaviour of 'toolbox' conditional
Commit 6c86cabbe5 changed the command line interface to behave
a lot similar to that of github.com/coreos/toolbox, which makes things
easier for those switching over from it. Make it conditional so that
only those OS distributors who truly need it may enable it, and
restore the previous behaviour as the default.

The tests were updated to test the default behaviour that the vast
majority of users would be seeing. Ideally, the test suite would be run
twice with the migration path turned off and on. However, that would
require a more intrusive surgery of the test suite and likely make it
slower. It might not be worth the hassle because of the small number
of users who should be using the migration path.

Note that the copyright and license notices really must use C++-style
// line comments, because build constraints can only be preceded by
blank lines and other line comments. C-style /* */ block comments can't
precede the build constraints.

This reverts commit ca899c8a56 and parts
of commit 3aeb7cf288.

[1] go help buildconstraint
    https://pkg.go.dev/cmd/go#hdr-Build_constraints

https://github.com/containers/toolbox/pull/951
2021-12-10 01:33:24 +01:00
..
libs test/system: Test startup on Rawhide with supported versions 2021-12-04 17:37:40 +02:00
000-setup.bats test/system: Test startup on Rawhide with supported versions 2021-12-04 17:37:40 +02:00
001-version.bats test/system: Add function for setting up environment 2021-12-01 01:09:34 +02:00
002-help.bats cmd, test/system: Make the behaviour of 'toolbox' conditional 2021-12-10 01:33:24 +01:00
101-create.bats test/system: Add function for setting up environment 2021-12-01 01:09:34 +02:00
102-list.bats test/system: Add function for setting up environment 2021-12-01 01:09:34 +02:00
103-container.bats test/system: Test startup on Rawhide with supported versions 2021-12-04 17:37:40 +02:00
104-run.bats test/system: Add function for setting up environment 2021-12-01 01:09:34 +02:00
105-enter.bats test/system: Add function for setting up environment 2021-12-01 01:09:34 +02:00
106-rm.bats test/system: Add function for setting up environment 2021-12-01 01:09:34 +02:00
107-rmi.bats test/system: Add function for setting up environment 2021-12-01 01:09:34 +02:00
999-teardown.bats test/system: Make tests non-destructive 2021-12-01 01:09:34 +02:00
README.md test/system: Make tests non-destructive 2021-12-01 01:09:34 +02:00

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

  • awk
  • bats
  • GNU coreutils
  • podman
  • skopeo
  • toolbox

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() and teardown() 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.