Merge pull request #14059 from cdoern/clone

pass networks to container clone
This commit is contained in:
OpenShift Merge Robot
2022-05-05 05:51:19 -04:00
committed by GitHub
5 changed files with 56 additions and 8 deletions

View File

@@ -266,4 +266,30 @@ var _ = Describe("Podman container clone", func() {
Expect(clone).ToNot(Exit(0))
})
It("podman container clone network passing", func() {
networkCreate := podmanTest.Podman([]string{"network", "create", "testing123"})
networkCreate.WaitWithDefaultTimeout()
defer podmanTest.removeNetwork("testing123")
Expect(networkCreate).To(Exit(0))
run := podmanTest.Podman([]string{"run", "--network", "bridge", "-dt", ALPINE})
run.WaitWithDefaultTimeout()
Expect(run).To(Exit(0))
connect := podmanTest.Podman([]string{"network", "connect", "testing123", run.OutputToString()})
connect.WaitWithDefaultTimeout()
Expect(connect).To(Exit(0))
clone := podmanTest.Podman([]string{"container", "clone", run.OutputToString()})
clone.WaitWithDefaultTimeout()
Expect(clone).To(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", clone.OutputToString()})
inspect.WaitWithDefaultTimeout()
Expect(inspect).To(Exit(0))
Expect(inspect.InspectContainerToJSON()[0].NetworkSettings.Networks).To(HaveLen(2))
_, ok := inspect.InspectContainerToJSON()[0].NetworkSettings.Networks["testing123"]
Expect(ok).To(BeTrue())
})
})