Skip to content

Commit

Permalink
[debug] tests/int: fix flake in runc delete test
Browse files Browse the repository at this point in the history
The following failure was observed in CI (on centos-stream-8 in
integration-cgroup suite):

	not ok 42 runc delete
	 (from function `fail' in file tests/integration/helpers.bash, line 338,
	  in test file tests/integration/delete.bats, line 30)
	   `[ "$output" = "" ] || fail "cgroup not cleaned up correctly: $output"' failed
	....
	cgroup not cleaned up correctly: /sys/fs/cgroup/pids/system.slice/tmp-bats\x2drun\x2d68012-runc.IPOypI-state-testbusyboxdelete-runc.zriC8C.mount
	/sys/fs/cgroup/cpu,cpuacct/system.slice/tmp-bats\x2drun\x2d68012-runc.IPOypI-state-testbusyboxdelete-runc.zriC8C.mount
	...

Apparently, this is a cgroup systemd creates for a mount unit which
appears then runc does internal /proc/self/exe bind-mount. The test
case should not take it into account.

Fix the find arguments to look for a specific cgroup name, and add
a check that these arguments are correct (i.e. the cgroup is found
when the container is running).

Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin committed Feb 23, 2022
1 parent 2436322 commit 8b67ba9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/integration/delete.bats
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@ function teardown() {
}

@test "runc delete" {
[[ "$ROOTLESS" -ne 0 ]] && requires rootless_cgroup

runc run -d --console-socket "$CONSOLE_SOCKET" testbusyboxdelete
[ "$status" -eq 0 ]

testcontainer testbusyboxdelete running
# Ensure the find statement used later is correct.
output=$(find /sys/fs/cgroup -name testbusyboxdelete -o -name \*-testbusyboxdelete.scope)
if [ -z "$output" ]; then
find /sys/fs/cgroup -wholename \*testbusyboxdelete\*
fail "expected cgroup not found"
fi

runc kill testbusyboxdelete KILL
[ "$status" -eq 0 ]
Expand All @@ -26,7 +34,7 @@ function teardown() {
runc state testbusyboxdelete
[ "$status" -ne 0 ]

output=$(find /sys/fs/cgroup -wholename '*testbusyboxdelete*' -type d)
output=$(find /sys/fs/cgroup -name testbusyboxdelete -o -name \*-testbusyboxdelete.scope)
[ "$output" = "" ] || fail "cgroup not cleaned up correctly: $output"
}

Expand Down

0 comments on commit 8b67ba9

Please sign in to comment.