Skip to content

Commit 5e4870c

Browse files
committed
integration: add repeated "runc update" test
This is to ensure that we aren't leaking eBPF programs after "runc update". Unfortunately we cannot directly test the behaviour of cgroup program updates in an integration test because "runc update" doesn't support that behaviour at the moment. So instead we rely on the fact that each "runc update" implicitly triggers the devices rules to be updated. Without the previous patches applied, this new test will fail with errors. Signed-off-by: Aleksa Sarai <[email protected]>
1 parent bdaa6fe commit 5e4870c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/integration/update.bats

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,3 +648,30 @@ EOF
648648
runc resume test_update
649649
[ "$status" -eq 0 ]
650650
}
651+
652+
@test "runc update replaces devices cgroup program" {
653+
[[ "$ROOTLESS" -ne 0 ]] && requires rootless_cgroup
654+
655+
# Unfortunately we can't update device rules directly with runc ("runc
656+
# update" doesn't support it, and adding support would require ironing out
657+
# some long-standing design issues with device configuration). So instead
658+
# we just run "runc update" many times, relying on the fact that runc will
659+
# re-apply devices cgroup rules on each runc update.
660+
#
661+
# In the past runc would not delete old cgroupv2 eBPF programs, so this
662+
# test ensures that once we go past the program limit (64 stacked programs
663+
# at time of writing) you can still run "runc" update.
664+
665+
# Run the container in the background.
666+
runc run -d --console-socket "$CONSOLE_SOCKET" test_update
667+
[ "$status" -eq 0 ]
668+
669+
for new_limit in $(seq 300)
670+
do
671+
runc update --pids-limit "$((2*$new_limit))" test_update
672+
[ "$status" -eq 0 ]
673+
done
674+
675+
# The container should still be running.
676+
testcontainer test_update running
677+
}

0 commit comments

Comments
 (0)