From ed1f14afb549d417caa29e799beb737493c9db13 Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Thu, 28 May 2020 19:56:57 -0700 Subject: [PATCH] tests/int/events: skip oom test if no swap In case swap cgroup control is not available, the "event oom" test gives the following error: > # not ok 30 events oom > # (in test file tests/integration/events.bats, line 134) > # `[ "$status" -eq 0 ]' failed > # <....> > # runc run -d --console-socket /tmp/console.sock test_busybox (status=1): > # time="2020-05-29T02:10:20Z" level=warning msg="signal: killed" > # time="2020-05-29T02:10:20Z" level=error msg="container_linux.go:353: starting container process caused: process_linux.go:437: container init caused: process_linux.go:403: setting cgroup config for procHooks process caused: failed to write \"33554432\" to \"/sys/fs/cgroup/memory/test_busybox/memory.memsw.limit_in_bytes\": open /sys/fs/cgroup/memory/test_busybox/memory.memsw.limit_in_bytes: permission denied" When I try to run the test without setting the swap limit, the shell process is still getting killed, but the test hangs. I am not sure what the reason is, but realistically this test is hard to perform without the swap limit, so let's require cgroup swap for it. Signed-off-by: Kir Kolyshkin --- tests/integration/events.bats | 6 +++--- tests/integration/helpers.bash | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/integration/events.bats b/tests/integration/events.bats index 50c577e80..f51337598 100644 --- a/tests/integration/events.bats +++ b/tests/integration/events.bats @@ -112,11 +112,11 @@ function teardown() { [ "$status" -eq 0 ] } -@test "events oom " { +@test "events oom" { # XXX: currently cgroups require root containers. - requires root + requires root cgroups_swap init_cgroup_paths - + # we need the container to hit OOM, so disable swap # ("swap" here is actually memory+swap) DATA=$(cat <