Skip to content

Commit

Permalink
test: Make system container cleanup faster
Browse files Browse the repository at this point in the history
`podman system reset` defaults to waiting for 10s for containers to shut
down, which unnecessarily slows down tests (see
containers/podman#21874). To work around this,
force-stop all containers first with a zero timeout.
  • Loading branch information
martinpitt committed Mar 1, 2024
1 parent 232ea86 commit 663f752
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/check-application
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,22 @@ class TestApplication(testlib.MachineCase):
# backup/restore pristine podman state, so that tests can run on existing testbeds
self.restore_dir("/var/lib/containers")

# HACK: sometimes podman leaks mounts
self.addCleanup(m.execute, """
systemctl stop podman.service podman.socket
# HACK: system reset has 10s timeout, make that faster with an extra `stop`
# https://github.com/containers/podman/issues/21874
podman stop --time 0 --all
podman pod stop --time 0 --all
systemctl reset-failed podman.service podman.socket
podman system reset --force
pkill -e -9 podman || true
while pgrep podman; do sleep 0.1; done
pkill -e -9 conmon || true
while pgrep conmon; do sleep 0.1; done
# HACK: sometimes podman leaks mounts
findmnt --list -otarget | grep /var/lib/containers/. | xargs -r umount
sync
""")
Expand Down

0 comments on commit 663f752

Please sign in to comment.