Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Move from restore_dir() to podman system reset for user #1598

Merged
merged 1 commit into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions test/browser/browser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,8 @@ for retry in $(seq 5); do
sleep $((5 * retry * retry))
done

# copy images for user podman tests; podman insists on user session
loginctl enable-linger $(id -u admin)
for img in localhost/test-alpine localhost/test-busybox localhost/test-registry; do
podman save $img | sudo -i -u admin podman load
done
loginctl disable-linger $(id -u admin)
# image setup, shared with upstream tests
$TESTS/../vm.install

systemctl enable --now cockpit.socket podman.socket

Expand Down
18 changes: 13 additions & 5 deletions test/check-application
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,19 @@ class TestApplication(testlib.MachineCase):
ssh_port=m.ssh_port,
identity_file=m.identity_file)

# Enable user service as well
self.admin_s.execute("systemctl --user stop podman.service; systemctl --now --user enable podman.socket")
self.restore_dir("/home/admin/.local/share/containers")
self.addCleanup(self.admin_s.execute, "systemctl --user stop podman.service podman.socket || true")
# Ubuntu 22.04 has old podman that does not know about --time
# Enable user service as well; copy our images (except cockpit/ws) from system
self.admin_s.execute("""
systemctl --user stop podman.service
for img in $(ls /var/lib/test-images/*.tar | grep -v cockpitws); do podman load < "$img"; done
systemctl --now --user enable podman.socket
""")
self.addCleanup(self.admin_s.execute, """
systemctl --user stop podman.service podman.socket
podman system reset --force
""")
# HACK: system reset has 10s timeout, make that faster with an extra `stop`
# https://github.com/containers/podman/issues/21874
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reporting that!

# Ubuntu 22.04 has old podman that does not know about rm --time
if m.image == 'ubuntu-2204':
self.addCleanup(self.admin_s.execute, "podman rm --force --all", timeout=300)
self.addCleanup(self.admin_s.execute, "podman pod rm --force --all", timeout=300)
Expand Down
11 changes: 5 additions & 6 deletions test/vm.install
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@ fi
# Since 4.0 podman now ships the pause image
podman images --format '{{.Repository}}:{{.Tag}}' | grep -Ev 'localhost/test-|pause|cockpit/ws' | xargs -r podman rmi -f

# copy images for user podman tests; podman insists on user session
loginctl enable-linger $(id -u admin)
images=$(podman images --format '{{.Repository}}:{{.Tag}}')
for img in $images; do
podman save $img | sudo -i -u admin podman load
# tests reset podman, save the images
mkdir -p /var/lib/test-images
for img in $(podman images --format '{{.Repository}}:{{.Tag}}'); do
fname="$(echo "$img" | tr -dc '[a-zA-Z-]')"
podman save -o "/var/lib/test-images/${fname}.tar" "$img"
done
loginctl disable-linger $(id -u admin)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to cleanup the lingering!


# 15minutes after boot tmp files are removed and podman stores some tmp lock files
systemctl disable --now systemd-tmpfiles-clean.timer
Expand Down