toolbox/test/system/101-list.bats
Harry Míchal 1e2232762c test/system: Rework the tests
The tests introduced by commit b5cdc57ae3 have proven to be
rather unstable due to mistakes in their design. The tests were quite
chaotically structured, and because of that images were deleted and
pulled too often, causing several false positives [1, 2].

This changes the structure of the tests in a major way. The tests
(resp. commands) are now run in a manner that better simulates the way
Toolbox is actually used. From a clean state, through creating
containers, using them and in the end deleting them. This should
reduce the strain on the bandwidth and possibly even speed up the
tests themselves.

[1] https://github.com/containers/toolbox/pull/372
[2] https://github.com/containers/toolbox/pull/374

https://github.com/containers/toolbox/pull/375
2020-02-18 14:00:59 +01:00

24 lines
796 B
Bash

#!/usr/bin/env bats
load helpers
@test "Run list with zero containers and two images" {
run_toolbox list
is "${#lines[@]}" "3" "Expected number of lines of the output is 3 (Img: 3 + Spc: 0 + Cont: 0)"
is "${lines[1]}" ".*registry.fedoraproject.org/.*" "First of the two images"
is "${lines[2]}" ".*registry.fedoraproject.org/.*" "Second of the two images"
}
@test "Run list with zero containers (-c flag)" {
run_toolbox list -c
is "$output" "" "Output of list should be blank"
}
@test "Run list with zero images (-i flag)" {
run_toolbox list -i
is "${#lines[@]}" "3" "Expected number of lines of the output is 3"
is "${lines[1]}" ".*registry.fedoraproject.org/.*" "First of the two images"
is "${lines[2]}" ".*registry.fedoraproject.org/.*" "Second of the two images"
}