mirror of
https://github.com/containers/podman.git
synced 2025-06-19 16:33:24 +08:00
Added checkpoint/restore test for same IP
Restoring a container from a checkpoint should give the container the same IP as before checkpointing. This adds a test to make sure the IP stays the same. Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:

committed by
Adrian Reber

parent
e11cbd7129
commit
ab8e03b3e7
@ -290,4 +290,40 @@ var _ = Describe("Podman checkpoint", func() {
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
})
|
||||
|
||||
It("podman checkpoint and restore container with same IP", func() {
|
||||
session := podmanTest.Podman([]string{"run", "-it", "--security-opt", "seccomp=unconfined", "--name", "test_name", "-d", ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
|
||||
IPBefore := podmanTest.Podman([]string{"inspect", "-l", "--format={{.NetworkSettings.IPAddress}}"})
|
||||
IPBefore.WaitWithDefaultTimeout()
|
||||
Expect(IPBefore.ExitCode()).To(Equal(0))
|
||||
|
||||
result := podmanTest.Podman([]string{"container", "checkpoint", "test_name"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(result.ExitCode()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
|
||||
|
||||
result = podmanTest.Podman([]string{"container", "restore", "test_name"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
|
||||
IPAfter := podmanTest.Podman([]string{"inspect", "-l", "--format={{.NetworkSettings.IPAddress}}"})
|
||||
IPAfter.WaitWithDefaultTimeout()
|
||||
Expect(IPAfter.ExitCode()).To(Equal(0))
|
||||
|
||||
// Check that IP address did not change between checkpointing and restoring
|
||||
Expect(IPBefore.OutputToString()).To(Equal(IPAfter.OutputToString()))
|
||||
|
||||
Expect(result.ExitCode()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
|
||||
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
|
||||
|
||||
result = podmanTest.Podman([]string{"rm", "-fa"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result.ExitCode()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
})
|
||||
|
||||
})
|
||||
|
Reference in New Issue
Block a user