mirror of https://github.com/containers/podman.git
Add test case for container migration
The difference between container checkpoint/restore and container migration is that for migration the container which was checkpointed must not exist during restore. To simulate migration the container is remove ('podman rm -fa') before being restored. The migration test does following steps: * podman run * podman container checkpoint -l -e /tmp/checkpoint.tar.gz * podman rm -fa * podman container restore -i /tmp/checkpoint.tar.gz Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
parent
0028578b43
commit
2aa3261744
|
@ -347,4 +347,38 @@ var _ = Describe("Podman checkpoint", func() {
|
|||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
})
|
||||
|
||||
// This test does the same steps which are necessary for migrating
|
||||
// a container from one host to another
|
||||
It("podman checkpoint container with export (migration)", func() {
|
||||
// CRIU does not work with seccomp correctly on RHEL7
|
||||
session := podmanTest.Podman([]string{"run", "-it", "--security-opt", "seccomp=unconfined", "-d", ALPINE, "top"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
|
||||
|
||||
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.GetContainerStatus()).To(ContainSubstring("Exited"))
|
||||
|
||||
// Remove all containers to simulate migration
|
||||
result = podmanTest.Podman([]string{"rm", "-fa"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result.ExitCode()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
|
||||
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.GetContainerStatus()).To(ContainSubstring("Up"))
|
||||
|
||||
result = podmanTest.Podman([]string{"rm", "-fa"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result.ExitCode()).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue