Skip to content

Commit

Permalink
test: Fix race condition in test setup
Browse files Browse the repository at this point in the history
Stop podman.service before setting up the /var/lib/containers/ overlay
directory, so that we don't clobber an already existing /overlay mount
inside it.

Also, stop podman.service before tearing down the temporary
/var/lib/containers/.

Don't enable podman.socket in vm.install, as the tests already do it,
and talking to podman before the restore_dir() would mess things up.
  • Loading branch information
martinpitt committed Jul 29, 2020
1 parent f86be4b commit 3f78931
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions test/check-application
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,16 @@ class TestApplication(testlib.MachineCase):

def setUp(self):
super().setUp()
self.machine.execute("systemctl stop podman.service; systemctl --now enable podman.socket")

# backup/restore pristine podman state, so that tests can run on existing testbeds
self.restore_dir("/var/lib/containers")
self.addCleanup(self.machine.execute, "systemctl stop podman.service")

# HACK: sometimes podman leaks mounts
self.addCleanup(self.machine.execute, "podman rm --force --all && "
"findmnt --list -otarget | grep /var/lib/containers/. | xargs -r umount || true")

self.machine.execute("systemctl stop podman.service; systemctl --now enable podman.socket")

# Create admin session
self.machine.execute("""
mkdir /home/admin/.ssh
Expand Down
2 changes: 1 addition & 1 deletion test/vm.install
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if [ -d /var/tmp/debian ]; then
systemctl disable docker.service io.podman.service
fi

systemctl enable cockpit.socket podman.socket
systemctl enable cockpit.socket

# don't force https:// (self-signed cert)
printf "[WebService]\\nAllowUnencrypted=true\\n" > /etc/cockpit/cockpit.conf
Expand Down

0 comments on commit 3f78931

Please sign in to comment.