test/system: Simplify the line count checks by relying on Bats >= 1.7.0
Fedora 35 was stuck with Bats 1.5.0. However, it reached End of Life on
13th December 2022 and was dropped from the CI [1]. Fedora 36 is the
oldest supported Fedora and it has Bats 1.8.2.
Therefore, there's no need to retain compatibility with Bats < 1.7.0.
Note that bats_require_minimum_version itself is only available from
Bats 1.7.0 [2].
[1] Commit 419e4e8cd9
https://github.com/containers/toolbox/pull/1237
[2] Bats commit 71d6b71cebc3d32b
https://github.com/bats-core/bats-core/issues/556
https://bats-core.readthedocs.io/en/stable/warnings/BW02.html
https://github.com/containers/toolbox/pull/1273
This commit is contained in:
parent
08e40e666e
commit
e22a82fec8
1 changed files with 7 additions and 18 deletions
|
@ -20,6 +20,7 @@ load 'libs/bats-assert/load'
|
|||
load 'libs/helpers'
|
||||
|
||||
setup() {
|
||||
bats_require_minimum_version 1.7.0
|
||||
_setup_environment
|
||||
cleanup_all
|
||||
}
|
||||
|
@ -71,9 +72,7 @@ teardown() {
|
|||
assert_success
|
||||
assert_line --index 1 --partial "<none>"
|
||||
assert [ ${#lines[@]} -eq 3 ]
|
||||
if check_bats_version 1.7.0; then
|
||||
assert [ ${#stderr_lines[@]} -eq 0 ]
|
||||
fi
|
||||
}
|
||||
|
||||
@test "list: Image and its copy" {
|
||||
|
@ -92,9 +91,7 @@ teardown() {
|
|||
assert_line --index 1 --partial "$default_image"
|
||||
assert_line --index 2 --partial "$default_image-copy"
|
||||
assert [ ${#lines[@]} -eq 4 ]
|
||||
if check_bats_version 1.7.0; then
|
||||
assert [ ${#stderr_lines[@]} -eq 0 ]
|
||||
fi
|
||||
}
|
||||
|
||||
@test "list: Containers and images" {
|
||||
|
@ -114,9 +111,7 @@ teardown() {
|
|||
assert_line --index 1 --partial "fedora-toolbox:34"
|
||||
assert_line --index 2 --partial "$(get_system_id)-toolbox:$(get_system_version)"
|
||||
assert [ ${#lines[@]} -eq 4 ]
|
||||
if check_bats_version 1.7.0; then
|
||||
assert [ ${#stderr_lines[@]} -eq 0 ]
|
||||
fi
|
||||
|
||||
# Check containers
|
||||
run --keep-empty-lines --separate-stderr $TOOLBOX list --containers
|
||||
|
@ -126,9 +121,7 @@ teardown() {
|
|||
assert_line --index 2 --partial "non-default-one"
|
||||
assert_line --index 3 --partial "non-default-two"
|
||||
assert [ ${#lines[@]} -eq 5 ]
|
||||
if check_bats_version 1.7.0; then
|
||||
assert [ ${#stderr_lines[@]} -eq 0 ]
|
||||
fi
|
||||
|
||||
# Check all together
|
||||
run --keep-empty-lines --separate-stderr $TOOLBOX list
|
||||
|
@ -140,9 +133,7 @@ teardown() {
|
|||
assert_line --index 6 --partial "non-default-one"
|
||||
assert_line --index 7 --partial "non-default-two"
|
||||
assert [ ${#lines[@]} -eq 9 ]
|
||||
if check_bats_version 1.7.0; then
|
||||
assert [ ${#stderr_lines[@]} -eq 0 ]
|
||||
fi
|
||||
}
|
||||
|
||||
@test "list: Images with and without names" {
|
||||
|
@ -160,7 +151,5 @@ teardown() {
|
|||
assert_line --index 2 --partial "fedora-toolbox:34"
|
||||
assert_line --index 3 --partial "$default_image"
|
||||
assert [ ${#lines[@]} -eq 5 ]
|
||||
if check_bats_version 1.7.0; then
|
||||
assert [ ${#stderr_lines[@]} -eq 0 ]
|
||||
fi
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue