From 5375401960cf0a9b716bb18eacdb07ffbb0e6da1 Mon Sep 17 00:00:00 2001 From: cdoern Date: Wed, 20 Apr 2022 21:40:47 -0400 Subject: podman container clone -f add the option -f to force remove the parent container if --destory is specified resolves #13917 Signed-off-by: cdoern --- test/e2e/container_clone_test.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test') diff --git a/test/e2e/container_clone_test.go b/test/e2e/container_clone_test.go index 1d5944d1a..1ff4b3b5f 100644 --- a/test/e2e/container_clone_test.go +++ b/test/e2e/container_clone_test.go @@ -235,4 +235,36 @@ var _ = Describe("Podman container clone", func() { Expect(ctrInspect.InspectContainerToJSON()[0].HostConfig.NetworkMode).Should(ContainSubstring("container:")) }) + + It("podman container clone --destroy --force test", func() { + create := podmanTest.Podman([]string{"create", ALPINE}) + create.WaitWithDefaultTimeout() + Expect(create).To(Exit(0)) + clone := podmanTest.Podman([]string{"container", "clone", "--destroy", create.OutputToString()}) + clone.WaitWithDefaultTimeout() + Expect(clone).To(Exit(0)) + + inspect := podmanTest.Podman([]string{"inspect", create.OutputToString()}) + inspect.WaitWithDefaultTimeout() + Expect(inspect).ToNot(Exit(0)) + + run := podmanTest.Podman([]string{"run", "-dt", ALPINE}) + run.WaitWithDefaultTimeout() + Expect(run).To(Exit(0)) + clone = podmanTest.Podman([]string{"container", "clone", "--destroy", "-f", run.OutputToString()}) + clone.WaitWithDefaultTimeout() + Expect(clone).To(Exit(0)) + + inspect = podmanTest.Podman([]string{"inspect", run.OutputToString()}) + inspect.WaitWithDefaultTimeout() + Expect(inspect).ToNot(Exit(0)) + + run = podmanTest.Podman([]string{"run", "-dt", ALPINE}) + run.WaitWithDefaultTimeout() + Expect(run).To(Exit(0)) + clone = podmanTest.Podman([]string{"container", "clone", "-f", run.OutputToString()}) + clone.WaitWithDefaultTimeout() + Expect(clone).ToNot(Exit(0)) + + }) }) -- cgit v1.2.3-54-g00ecf