From 15677e7b030498fb0483a924d6597f4e5faf2bd0 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Tue, 26 Jul 2022 13:17:18 -0700 Subject: [PATCH] ci: fix delete.bats for GHA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/integration/delete.bats | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/delete.bats b/tests/integration/delete.bats index d8e02f939..9b95b845a 100644 --- a/tests/integration/delete.bats +++ b/tests/integration/delete.bats @@ -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" }