From cd46e727959efb0e1f5f9b33ea436f88df650c83 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 13 Apr 2023 16:22:47 +0200 Subject: [PATCH] test/e2e: fix pause tests to unpause before cleanup() The Cleanup() function tries to stop all containers, a paused contianer cannot be stopped. The tests should make sure it works. Signed-off-by: Paul Holzinger --- test/e2e/cleanup_test.go | 6 ++++++ test/e2e/pause_test.go | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/test/e2e/cleanup_test.go b/test/e2e/cleanup_test.go index 46e88804a8..1563212c0d 100644 --- a/test/e2e/cleanup_test.go +++ b/test/e2e/cleanup_test.go @@ -124,5 +124,11 @@ var _ = Describe("Podman container cleanup", func() { session.WaitWithDefaultTimeout() Expect(session).Should(Exit(125)) Expect(session.ErrorToString()).To(ContainSubstring("container state improper")) + + // unpause so that the cleanup can stop the container, + // otherwise it fails with container state improper + session = podmanTest.Podman([]string{"unpause", "paused"}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) }) }) diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go index b67a46e1c1..d91fc018ac 100644 --- a/test/e2e/pause_test.go +++ b/test/e2e/pause_test.go @@ -151,6 +151,11 @@ var _ = Describe("Podman pause", func() { Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) Expect(strings.ToLower(podmanTest.GetContainerStatus())).To(ContainSubstring(pausedState)) + // unpause so that the cleanup can stop the container, + // otherwise it fails with container state improper + session = podmanTest.Podman([]string{"unpause", cid}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) }) It("podman remove a paused container by id with force", func() {