Skip to content

Commit

Permalink
System tests: fix two races
Browse files Browse the repository at this point in the history
Two tests were running 'container rm' on 'start'ed containers
that might not yet have exited. Fix. Also, tighten up the
tests themselves, to make even more sure that they test
what they're supposed to test.

Fixes: containers#15783

Signed-off-by: Ed Santiago <santiago@redhat.com>
  • Loading branch information
edsantiago committed Sep 14, 2022
1 parent ae20f19 commit b43532d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
16 changes: 12 additions & 4 deletions test/system/035-logs.bats
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,21 @@ function _log_test_tail() {
run_podman run -d --log-driver=$driver $IMAGE sh -c "echo test1; echo test2"
cid="$output"

run_podman logs --tail 1 $cid
is "$output" "test2" "logs should only show last line"
run_podman wait $cid
run_podman logs --tail 1 --timestamps $cid
log1="$output"
assert "$log1" =~ "^[0-9-]+T[0-9:.]+[\+-][0-9:]+ test2" \
"logs should only show last line"

run_podman restart $cid
run_podman wait $cid

run_podman logs --tail 1 $cid
is "$output" "test2" "logs should only show last line after restart"
run_podman logs -t --tail 1 $cid
log2="$output"
assert "$log2" =~ "^[0-9-]+T[0-9:.]+[\+-][0-9:]+ test2" \
"logs, after restart, shows only last line"

assert "$log2" != "$log1" "log timestamps should differ"

run_podman rm $cid
}
Expand Down
5 changes: 4 additions & 1 deletion test/system/420-cgroups.bats
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ load helpers
esac

run_podman --cgroup-manager=$other run --name myc $IMAGE true
assert "$output" = "" "run true, with cgroup-manager=$other, is silent"

run_podman container inspect --format '{{.HostConfig.CgroupManager}}' myc
is "$output" "$other" "podman preserved .HostConfig.CgroupManager"

Expand All @@ -29,7 +31,8 @@ load helpers

# Restart the container, without --cgroup-manager option (ie use default)
# Prior to #7970, this would fail with an OCI runtime error
run_podman start myc
run_podman start -a myc
assert "$output" = "" "restarted container emits no output"

run_podman rm myc
}
Expand Down

0 comments on commit b43532d

Please sign in to comment.