test/system: Group the test cases somewhat logically

It seems that as new test cases got developed they got appended towards
the end of the file.  Now that there are a non-trivial number of test
cases, it's difficult to look at the file and get a gist of all the
scenarios being tested.

It will be better to have some logical grouping -- starting with the
most basic functionality, then moving on to more advanced features,
and then finally the errors.

This a step towards that.

https://github.com/containers/toolbox/pull/1152
This commit is contained in:
Debarshi Ray 2022-11-08 19:58:25 +01:00
parent 1ce59a6a2d
commit 3326dda259

View file

@ -13,6 +13,15 @@ teardown() {
cleanup_containers
}
@test "run: Run command exiting with zero code in the default container" {
create_default_container
run $TOOLBOX run true
assert_success
assert_output ""
}
@test "run: Ensure that a login shell is used to invoke the command" {
create_default_container
@ -28,6 +37,27 @@ teardown() {
assert [ ${#lines[@]} -eq 1 ]
}
@test "run: Run echo 'Hello World' inside of the default container" {
create_default_container
run $TOOLBOX --verbose run echo -n "Hello World"
assert_success
assert_line --index $((${#lines[@]}-1)) "Hello World"
}
@test "run: Run echo 'Hello World' inside a container after being stopped" {
create_container running
start_container running
stop_container running
run $TOOLBOX --verbose run --container running echo -n "Hello World"
assert_success
assert_line --index $((${#lines[@]}-1)) "Hello World"
}
@test "run: Try to run a command in the default container with no containers created" {
local default_container_name="$(get_system_id)-toolbox-$(get_system_version)"
@ -136,27 +166,6 @@ teardown() {
assert [ ${#lines[@]} -eq 3 ]
}
@test "run: Run echo 'Hello World' inside of the default container" {
create_default_container
run $TOOLBOX --verbose run echo -n "Hello World"
assert_success
assert_line --index $((${#lines[@]}-1)) "Hello World"
}
@test "run: Run echo 'Hello World' inside a container after being stopped" {
create_container running
start_container running
stop_container running
run $TOOLBOX --verbose run --container running echo -n "Hello World"
assert_success
assert_line --index $((${#lines[@]}-1)) "Hello World"
}
@test "run: Run sudo id inside of the default container" {
create_default_container
@ -172,15 +181,6 @@ teardown() {
assert_output --partial "uid=0(root)"
}
@test "run: Run command exiting with zero code in the default container" {
create_default_container
run $TOOLBOX run true
assert_success
assert_output ""
}
@test "run: Run command exiting with non-zero code in the default container" {
create_default_container