summaryrefslogtreecommitdiff
path: root/test/e2e/checkpoint_test.go
diff options
context:
space:
mode:
authorAdrian Reber <areber@redhat.com>2019-06-25 12:28:18 +0000
committerAdrian Reber <areber@redhat.com>2019-06-25 19:42:04 +0200
commit95719b6d6b2cf7eae9b60e9a46161a2cbbe588b7 (patch)
treec534d72ab5b33956dc226f080204a83dec2f8808 /test/e2e/checkpoint_test.go
parent220e169cc1f04a17b25d7af0994715f75be0d249 (diff)
downloadpodman-95719b6d6b2cf7eae9b60e9a46161a2cbbe588b7.tar.gz
podman-95719b6d6b2cf7eae9b60e9a46161a2cbbe588b7.tar.bz2
podman-95719b6d6b2cf7eae9b60e9a46161a2cbbe588b7.zip
Add exec after checkpoint/restore test
A container restored from a checkpoint archive used to have the root file-system mounted with a wrong (new) SELinux label. This made it, for example, impossible to use 'podman exec' on a restored container. This test tests exactly this. 'podman exec' after 'podman container restore'. Unfortunately this test does not fail, even without the patch that fixes it as the test seems to run in an environment where the SELinux label of the container root file-system is not relevant. Somehow. Signed-off-by: Adrian Reber <areber@redhat.com>
Diffstat (limited to 'test/e2e/checkpoint_test.go')
-rw-r--r--test/e2e/checkpoint_test.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index d452a062b..c60a99386 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -392,4 +392,43 @@ var _ = Describe("Podman checkpoint", func() {
// Remove exported checkpoint
os.Remove("/tmp/checkpoint.tar.gz")
})
+
+ It("podman checkpoint and run exec in restored container", func() {
+ // Start the container
+ session := podmanTest.Podman([]string{"run", "-it", "--rm", "-d", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+ cid := session.OutputToString()
+
+ // Checkpoint the container
+ result := podmanTest.Podman([]string{"container", "checkpoint", "-l", "-e", "/tmp/checkpoint.tar.gz"})
+ result.WaitWithDefaultTimeout()
+
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainers()).To(Equal(0))
+
+ // Restore the container
+ result = podmanTest.Podman([]string{"container", "restore", "-i", "/tmp/checkpoint.tar.gz"})
+ result.WaitWithDefaultTimeout()
+
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+ Expect(podmanTest.NumberOfContainers()).To(Equal(1))
+ Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
+
+ // Exec in the container
+ result = podmanTest.Podman([]string{"exec", "-l", "/bin/sh", "-c", "echo " + cid + " > /test.output"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+
+ result = podmanTest.Podman([]string{"exec", "-l", "cat", "/test.output"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(result.OutputToString()).To(ContainSubstring(cid))
+
+ // Remove exported checkpoint
+ os.Remove("/tmp/checkpoint.tar.gz")
+ })
})