ci: fix delete.bats for GHA

A couple of test cases in delete.bats check that a particular cgroup
exists (or doesn't exist) using find. This is now resulting in errors
like these:

        find: ‘/sys/fs/cgroup/blkio/azsec’: Permission denied
        find: ‘/sys/fs/cgroup/blkio/azsec_clamav’: Permission denied
        find: ‘/sys/fs/cgroup/cpu,cpuacct/azsec’: Permission denied
        find: ‘/sys/fs/cgroup/cpu,cpuacct/azsec_clamav’: Permission denied
        find: ‘/sys/fs/cgroup/memory/azsec’: Permission denied
        find: ‘/sys/fs/cgroup/memory/azsec_clamav’: Permission denied

leading to test case failures.

Apparently, GHA runs something else on a test box, so we get this.

To fix, ignore non-zero exit code from find, and redirect its stderr
to /dev/null.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
Kir Kolyshkin
2022-07-26 13:17:18 -07:00
parent e7461c8c29
commit 15677e7b03
+3 -3
View File
@@ -23,7 +23,7 @@ function teardown() {
testcontainer testbusyboxdelete running
# Ensure the find statement used later is correct.
output=$(find /sys/fs/cgroup -name testbusyboxdelete -o -name \*-testbusyboxdelete.scope)
output=$(find /sys/fs/cgroup -name testbusyboxdelete -o -name \*-testbusyboxdelete.scope 2>/dev/null || true)
if [ -z "$output" ]; then
fail "expected cgroup not found"
fi
@@ -38,7 +38,7 @@ function teardown() {
runc state testbusyboxdelete
[ "$status" -ne 0 ]
output=$(find /sys/fs/cgroup -name testbusyboxdelete -o -name \*-testbusyboxdelete.scope)
output=$(find /sys/fs/cgroup -name testbusyboxdelete -o -name \*-testbusyboxdelete.scope 2>/dev/null || true)
[ "$output" = "" ] || fail "cgroup not cleaned up correctly: $output"
}
@@ -118,7 +118,7 @@ EOF
runc state test_busybox
[ "$status" -ne 0 ]
output=$(find /sys/fs/cgroup -wholename '*testbusyboxdelete*' -type d)
output=$(find /sys/fs/cgroup -wholename '*testbusyboxdelete*' -type d 2>/dev/null || true)
[ "$output" = "" ] || fail "cgroup not cleaned up correctly: $output"
}