test/system: Check whole lines instead of partials
The 'toolbox run' command has one downside: all newlines contain a carriage return (CR). This is caused by the unconditional use of the --tty option in `podman exec`[0]. In these particular tests this can be worked around by not printing a newline at all. Another quirk around partial is to check the last line of the output. [0] https://github.com/containers/podman/issues/9718 https://github.com/containers/toolbox/pull/843
This commit is contained in:
parent
d9147fff8c
commit
16b0c5d88f
1 changed files with 4 additions and 6 deletions
|
@ -28,15 +28,13 @@ teardown() {
|
|||
assert_output --partial "Run 'toolbox --help' for usage."
|
||||
}
|
||||
|
||||
#TODO: This should work without --partial
|
||||
# The issue here is that toolbox output add the CRLF character at the end
|
||||
@test "run: Run echo 'Hello World' inside of the default container" {
|
||||
create_default_container
|
||||
|
||||
run $TOOLBOX --verbose run echo "Hello World"
|
||||
run $TOOLBOX --verbose run echo -n "Hello World"
|
||||
|
||||
assert_success
|
||||
assert_output --partial "Hello World"
|
||||
assert_line --index $((${#lines[@]}-1)) "Hello World"
|
||||
}
|
||||
|
||||
@test "run: Run echo 'Hello World' inside a container after being stopped" {
|
||||
|
@ -48,7 +46,7 @@ teardown() {
|
|||
run $TOOLBOX --verbose run --container running echo -n "Hello World"
|
||||
|
||||
assert_success
|
||||
assert_output --partial "Hello World"
|
||||
assert_line --index $((${#lines[@]}-1)) "Hello World"
|
||||
}
|
||||
|
||||
@test "run: Run sudo id inside of the default container" {
|
||||
|
@ -57,5 +55,5 @@ teardown() {
|
|||
run $TOOLBOX --verbose run sudo id
|
||||
|
||||
assert_success
|
||||
assert_output --partial "uid=0(root)"
|
||||
assert_line --index $((${#lines[@]}-1)) --partial "uid=0(root)"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue