diff options
author | Radostin Stoyanov <radostin@redhat.com> | 2021-11-17 22:17:21 +0000 |
---|---|---|
committer | Radostin Stoyanov <radostin@redhat.com> | 2021-11-18 19:23:48 +0000 |
commit | 7098463e7808c4a59c5a6404127ffad0863625b1 (patch) | |
tree | 6ad5b6e5099df507ff1cf1bff64624224f0a8879 /test/e2e | |
parent | 6d23ea60d255b750a8e221cb9964f552218d4297 (diff) | |
download | podman-7098463e7808c4a59c5a6404127ffad0863625b1.tar.gz podman-7098463e7808c4a59c5a6404127ffad0863625b1.tar.bz2 podman-7098463e7808c4a59c5a6404127ffad0863625b1.zip |
Add test for checkpoint/restore with --file-locks
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/checkpoint_test.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go index 14545c4f9..4963b04fc 100644 --- a/test/e2e/checkpoint_test.go +++ b/test/e2e/checkpoint_test.go @@ -1340,4 +1340,41 @@ var _ = Describe("Podman checkpoint", func() { Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) }) + It("podman checkpoint and restore container with --file-locks", func() { + if !strings.Contains(podmanTest.OCIRuntime, "runc") { + // TODO: Enable test for crun when this feature has been released + // https://github.com/containers/crun/pull/783 + Skip("FIXME: requires crun >= 1.4") + } + localRunString := getRunString([]string{"--name", "test_name", ALPINE, "flock", "test.lock", "sleep", "100"}) + session := podmanTest.Podman(localRunString) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + + // Checkpoint is expected to fail without --file-locks + result := podmanTest.Podman([]string{"container", "checkpoint", "test_name"}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(125)) + Expect(result.ErrorToString()).To(ContainSubstring("criu failed")) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) + + // Checkpoint is expected to succeed with --file-locks + result = podmanTest.Podman([]string{"container", "checkpoint", "--file-locks", "test_name"}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited")) + + result = podmanTest.Podman([]string{"container", "restore", "--file-locks", "test_name"}) + result.WaitWithDefaultTimeout() + + Expect(result).Should(Exit(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) + Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up")) + + result = podmanTest.Podman([]string{"rm", "-t", "0", "-f", "test_name"}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + }) }) |