toolbox/test/system/201-run.bats
Ondřej Míchal 083aec96f2 test/system: Rework check if toolbox started successfully
When I added the test that looked at the logs of a toolbox, I did not
realize that the startup of a toolbox takes some time. That caused the
CI to flake even more than usual.

The solution I used was inspired by a helper function in Podman's test
suite (WaitContainerReady()).

https://github.com/containers/toolbox/pull/594
2020-10-24 17:32:15 +02:00

29 lines
899 B
Bash

#!/usr/bin/env bats
load helpers
@test "Start the 'running' container and check it started alright" {
run_podman --log-level debug start running
is_toolbox_ready running
}
@test "Echo 'Hello World' inside of the default container" {
run_toolbox run echo "Hello World"
# is "$output" "Hello World" "Should say 'Hello World'"
}
@test "Echo 'Hello World' inside of the 'running' container" {
run_toolbox run -c running echo "Hello World"
# is "$output" "Hello World" "Should say 'Hello World'"
}
@test "Stop the 'running' container using 'podman stop'" {
run_podman stop running
is "${#lines[@]}" "1" "Expected number of lines of the output is 1 (with the id of the container)"
}
@test "Echo 'hello World' again in the 'running' container after being stopped and exit" {
run_toolbox run -c running echo "Hello World"
# is "$output" "Hello World" "Should say 'Hello World'"
}