summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-12-17 16:04:26 +0100
committerGitHub <noreply@github.com>2021-12-17 16:04:26 +0100
commit59766ebe76fe5bdd15256f5d39d063c95304989f (patch)
tree97e92d5a1ce224481b78003dd8ef6f65a913cf1c /test/e2e
parent820cf0e0661764de4e61e3d27a603acec817a363 (diff)
parent28018ce604057633cf88fc34719ce28a812237b3 (diff)
downloadpodman-59766ebe76fe5bdd15256f5d39d063c95304989f.tar.gz
podman-59766ebe76fe5bdd15256f5d39d063c95304989f.tar.bz2
podman-59766ebe76fe5bdd15256f5d39d063c95304989f.zip
Merge pull request #12625 from adrianreber/2021-12-16-podman-inspect
Add more checkpoint/restore information to 'inspect'
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/checkpoint_test.go80
1 files changed, 76 insertions, 4 deletions
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 064c82621..8103a0f6b 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -91,25 +91,97 @@ var _ = Describe("Podman checkpoint", func() {
Expect(session).Should(Exit(0))
cid := session.OutputToString()
- result := podmanTest.Podman([]string{"container", "checkpoint", cid})
+ // Check if none of the checkpoint/restore specific information is displayed
+ // for newly started containers.
+ inspect := podmanTest.Podman([]string{"inspect", cid})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).Should(Exit(0))
+ inspectOut := inspect.InspectContainerToJSON()
+ Expect(inspectOut[0].State.Checkpointed).To(BeFalse(), ".State.Checkpointed")
+ Expect(inspectOut[0].State.Restored).To(BeFalse(), ".State.Restored")
+ Expect(inspectOut[0].State.CheckpointPath).To(Equal(""))
+ Expect(inspectOut[0].State.CheckpointLog).To(Equal(""))
+ Expect(inspectOut[0].State.RestoreLog).To(Equal(""))
+
+ result := podmanTest.Podman([]string{
+ "container",
+ "checkpoint",
+ "--keep",
+ cid,
+ })
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Exited"))
- inspect := podmanTest.Podman([]string{"inspect", cid})
+ // For a checkpointed container we expect the checkpoint related information
+ // to be populated.
+ inspect = podmanTest.Podman([]string{"inspect", cid})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
- inspectOut := inspect.InspectContainerToJSON()
+ inspectOut = inspect.InspectContainerToJSON()
Expect(inspectOut[0].State.Checkpointed).To(BeTrue(), ".State.Checkpointed")
+ Expect(inspectOut[0].State.Restored).To(BeFalse(), ".State.Restored")
+ Expect(inspectOut[0].State.CheckpointPath).To(ContainSubstring("userdata/checkpoint"))
+ Expect(inspectOut[0].State.CheckpointLog).To(ContainSubstring("userdata/dump.log"))
+ Expect(inspectOut[0].State.RestoreLog).To(Equal(""))
- result = podmanTest.Podman([]string{"container", "restore", cid})
+ result = podmanTest.Podman([]string{
+ "container",
+ "restore",
+ "--keep",
+ cid,
+ })
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring("Up"))
+
+ inspect = podmanTest.Podman([]string{"inspect", cid})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).Should(Exit(0))
+ inspectOut = inspect.InspectContainerToJSON()
+ Expect(inspectOut[0].State.Restored).To(BeTrue(), ".State.Restored")
+ Expect(inspectOut[0].State.Checkpointed).To(BeFalse(), ".State.Checkpointed")
+ Expect(inspectOut[0].State.CheckpointPath).To(ContainSubstring("userdata/checkpoint"))
+ Expect(inspectOut[0].State.CheckpointLog).To(ContainSubstring("userdata/dump.log"))
+ Expect(inspectOut[0].State.RestoreLog).To(ContainSubstring("userdata/restore.log"))
+
+ result = podmanTest.Podman([]string{
+ "container",
+ "stop",
+ "--timeout",
+ "0",
+ cid,
+ })
+ result.WaitWithDefaultTimeout()
+
+ Expect(result).Should(Exit(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+
+ result = podmanTest.Podman([]string{
+ "container",
+ "start",
+ cid,
+ })
+ result.WaitWithDefaultTimeout()
+
+ Expect(result).Should(Exit(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+
+ // Stopping and starting the container should remove all checkpoint
+ // related information from inspect again.
+ inspect = podmanTest.Podman([]string{"inspect", cid})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).Should(Exit(0))
+ inspectOut = inspect.InspectContainerToJSON()
+ Expect(inspectOut[0].State.Checkpointed).To(BeFalse(), ".State.Checkpointed")
+ Expect(inspectOut[0].State.Restored).To(BeFalse(), ".State.Restored")
+ Expect(inspectOut[0].State.CheckpointPath).To(Equal(""))
+ Expect(inspectOut[0].State.CheckpointLog).To(Equal(""))
+ Expect(inspectOut[0].State.RestoreLog).To(Equal(""))
})
It("podman checkpoint a running container by name", func() {