diff options
author | Radostin Stoyanov <radostin@redhat.com> | 2022-09-20 10:59:26 +0100 |
---|---|---|
committer | Radostin Stoyanov <radostin@redhat.com> | 2022-09-29 13:33:09 +0100 |
commit | ebff193f8bf5d18b7dd72e3ae4ca0cb5eef6169f (patch) | |
tree | ea942004f380967516b2b8a279f25d519cc725ed | |
parent | 9c3d8bb494f358ecff785ba81a58f2e05f1a98a1 (diff) | |
download | podman-ebff193f8bf5d18b7dd72e3ae4ca0cb5eef6169f.tar.gz podman-ebff193f8bf5d18b7dd72e3ae4ca0cb5eef6169f.tar.bz2 podman-ebff193f8bf5d18b7dd72e3ae4ca0cb5eef6169f.zip |
Add test for podman run with checkpoint image
The `podman run` command has been extended with support for checkpoint
images. A checkpoint image contains image files generated by criu that
allow to restore the runtime state of containerized applications. This
patch adds a test case for this functionality.
Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
-rw-r--r-- | test/e2e/checkpoint_image_test.go | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/e2e/checkpoint_image_test.go b/test/e2e/checkpoint_image_test.go index 5700802e8..7ab0b5ca5 100644 --- a/test/e2e/checkpoint_image_test.go +++ b/test/e2e/checkpoint_image_test.go @@ -295,4 +295,52 @@ var _ = Describe("Podman checkpoint", func() { Expect(result).Should(Exit(0)) Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) }) + + It("podman run checkpoint image to restore container", func() { + SkipIfContainerized("FIXME: #15015. All checkpoint tests hang when containerized.") + // Container image must be lowercase + checkpointImage := "alpine-checkpoint-" + strings.ToLower(RandomString(6)) + containerName := "alpine-container-" + RandomString(6) + + // Create container + localRunString := []string{"run", "-d", "--name", containerName, ALPINE, "top"} + session := podmanTest.Podman(localRunString) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + containerID1 := session.OutputToString() + + // Checkpoint container, create checkpoint image + result := podmanTest.Podman([]string{"container", "checkpoint", "--create-image", checkpointImage, "--keep", containerID1}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + + // Remove existing container + result = podmanTest.Podman([]string{"rm", "-t", "1", "-f", containerName}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(0)) + + // Restore containers from image using `podman run` + result = podmanTest.Podman([]string{"run", checkpointImage}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1)) + + // Check if the container is running + status := podmanTest.Podman([]string{"inspect", containerName, "--format={{.State.Status}}"}) + status.WaitWithDefaultTimeout() + Expect(status).Should(Exit(0)) + Expect(status.OutputToString()).To(Equal("running")) + + // Clean-up + result = podmanTest.Podman([]string{"rm", "-t", "0", "-fa"}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + + result = podmanTest.Podman([]string{"rmi", checkpointImage}) + result.WaitWithDefaultTimeout() + Expect(result).Should(Exit(0)) + Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0)) + }) }) |