summaryrefslogtreecommitdiff
path: root/test/e2e/checkpoint_test.go
diff options
context:
space:
mode:
authorAdrian Reber <areber@redhat.com>2019-01-08 14:18:00 +0000
committerAdrian Reber <adrian@lisas.de>2019-01-09 07:34:57 +0100
commitab8e03b3e7b682263d72ca53d31a059c7259320d (patch)
tree6263e2eee9d244aaa4bc65c292f08b31e6ee6402 /test/e2e/checkpoint_test.go
parente11cbd7129b3cb06cd38a07adcd1fb42bdc61100 (diff)
downloadpodman-ab8e03b3e7b682263d72ca53d31a059c7259320d.tar.gz
podman-ab8e03b3e7b682263d72ca53d31a059c7259320d.tar.bz2
podman-ab8e03b3e7b682263d72ca53d31a059c7259320d.zip
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>
Diffstat (limited to 'test/e2e/checkpoint_test.go')
-rw-r--r--test/e2e/checkpoint_test.go36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 894a519b1..ca2f35fc9 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -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))
+ })
+
})