Skip to content

Commit e6b4b5a

Browse files
committed
tests: bfq: skip tests on misbehaving udev systems
openSUSE has an unfortunate default udev setup which forcefully sets all loop devices to use the "none" scheduler, even if you manually set it. As this is a property of the host configuration (and udev is monitoring from the host) we cannot really change this behaviour from inside our test container. So we should just skip the test in this (hopefully unusual) case. Ideally tools running the test suite should disable this behaviour when running our test suite. Signed-off-by: Aleksa Sarai <[email protected]>
1 parent ceef984 commit e6b4b5a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/integration/cgroups.bats

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,26 @@ function setup() {
156156

157157
dev="$(setup_loopdev)"
158158

159+
# Some distributions (like openSUSE) have udev configured to forcefully
160+
# reset the scheduler for loopN devices to be "none", which breaks this
161+
# test. We cannot modify the udev behaviour of the host, but since this is
162+
# usually triggered by the "change" event from losetup, we can wait for a
163+
# little bit before continuing the test. For more details, see
164+
# <https://github.com/opencontainers/runc/issues/4781>.
165+
sleep 2s
166+
159167
# See if BFQ scheduler is available.
160168
if ! { grep -qw bfq "/sys/block/${dev#/dev/}/queue/scheduler" &&
161169
echo bfq >"/sys/block/${dev#/dev/}/queue/scheduler"; }; then
162170
skip "BFQ scheduler not available"
163171
fi
164172

173+
# Check that the device still has the right scheduler, in case we lost the
174+
# race above...
175+
if ! grep -qw '\[bfq\]' "/sys/block/${dev#/dev/}/queue/scheduler"; then
176+
skip "udev is configured to reset loop device io scheduler"
177+
fi
178+
165179
set_cgroups_path
166180

167181
IFS=$' \t:' read -r major minor <<<"$(lsblk -nd -o MAJ:MIN "$dev")"

0 commit comments

Comments
 (0)