summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/checkpoint_test.go45
-rw-r--r--test/e2e/common_test.go7
-rw-r--r--test/e2e/generate_kube_test.go40
-rw-r--r--test/e2e/healthcheck_run_test.go18
-rw-r--r--test/e2e/run_test.go8
-rw-r--r--test/e2e/runlabel_test.go1
6 files changed, 113 insertions, 6 deletions
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 95ec21433..d452a062b 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -347,4 +347,49 @@ 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"))
+
+ // Restore container a second time with different name
+ result = podmanTest.Podman([]string{"container", "restore", "-i", "/tmp/checkpoint.tar.gz", "-n", "restore_again"})
+ result.WaitWithDefaultTimeout()
+
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
+ 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))
+
+ // Remove exported checkpoint
+ os.Remove("/tmp/checkpoint.tar.gz")
+ })
})
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 0a388dc42..9529346b4 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -11,6 +11,7 @@ import (
"strings"
"testing"
+ "github.com/containers/libpod/cmd/podman/shared"
"github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/inspect"
"github.com/containers/libpod/pkg/rootless"
@@ -319,7 +320,7 @@ func (s *PodmanSessionIntegration) InspectImageJSON() []inspect.ImageData {
}
// InspectContainer returns a container's inspect data in JSON format
-func (p *PodmanTestIntegration) InspectContainer(name string) []inspect.ContainerData {
+func (p *PodmanTestIntegration) InspectContainer(name string) []shared.InspectContainer {
cmd := []string{"inspect", name}
session := p.Podman(cmd)
session.WaitWithDefaultTimeout()
@@ -466,8 +467,8 @@ func (p *PodmanTestIntegration) PullImage(image string) error {
// InspectContainerToJSON takes the session output of an inspect
// container and returns json
-func (s *PodmanSessionIntegration) InspectContainerToJSON() []inspect.ContainerData {
- var i []inspect.ContainerData
+func (s *PodmanSessionIntegration) InspectContainerToJSON() []shared.InspectContainer {
+ var i []shared.InspectContainer
err := json.Unmarshal(s.Out.Contents(), &i)
Expect(err).To(BeNil())
return i
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index 95d46476d..40cc534c2 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -4,6 +4,7 @@ package integration
import (
"os"
+ "path/filepath"
. "github.com/containers/libpod/test/utils"
"github.com/ghodss/yaml"
@@ -104,4 +105,43 @@ var _ = Describe("Podman generate kube", func() {
_, err := yaml.Marshal(kube.OutputToString())
Expect(err).To(BeNil())
})
+
+ It("podman generate and reimport kube on pod", func() {
+ podName := "toppod"
+ _, rc, _ := podmanTest.CreatePod(podName)
+ Expect(rc).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"create", "--pod", podName, "--name", "test1", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session2 := podmanTest.Podman([]string{"create", "--pod", podName, "--name", "test2", ALPINE, "top"})
+ session2.WaitWithDefaultTimeout()
+ Expect(session2.ExitCode()).To(Equal(0))
+
+ outputFile := filepath.Join(podmanTest.RunRoot, "pod.yaml")
+ kube := podmanTest.Podman([]string{"generate", "kube", "-f", outputFile, podName})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ session3 := podmanTest.Podman([]string{"pod", "rm", "-af"})
+ session3.WaitWithDefaultTimeout()
+ Expect(session3.ExitCode()).To(Equal(0))
+
+ session4 := podmanTest.Podman([]string{"play", "kube", outputFile})
+ session4.WaitWithDefaultTimeout()
+ Expect(session4.ExitCode()).To(Equal(0))
+
+ session5 := podmanTest.Podman([]string{"pod", "ps"})
+ session5.WaitWithDefaultTimeout()
+ Expect(session5.ExitCode()).To(Equal(0))
+ Expect(session5.OutputToString()).To(ContainSubstring(podName))
+
+ session6 := podmanTest.Podman([]string{"ps", "-a"})
+ session6.WaitWithDefaultTimeout()
+ Expect(session6.ExitCode()).To(Equal(0))
+ psOut := session6.OutputToString()
+ Expect(psOut).To(ContainSubstring("test1"))
+ Expect(psOut).To(ContainSubstring("test2"))
+ })
})
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go
index be54cf1bd..125002bf9 100644
--- a/test/e2e/healthcheck_run_test.go
+++ b/test/e2e/healthcheck_run_test.go
@@ -5,6 +5,7 @@ package integration
import (
"fmt"
"os"
+ "time"
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
@@ -43,13 +44,24 @@ var _ = Describe("Podman healthcheck run", func() {
})
It("podman healthcheck on valid container", func() {
+ Skip("Extremely consistent flake - reenable on debugging")
session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", healthcheck})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
- hc.WaitWithDefaultTimeout()
- Expect(hc.ExitCode()).To(Equal(0))
+ exitCode := 999
+
+ // Buy a little time to get container running
+ for i := 0; i < 5; i++ {
+ hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
+ hc.WaitWithDefaultTimeout()
+ exitCode = hc.ExitCode()
+ if exitCode == 0 || i == 4 {
+ break
+ }
+ time.Sleep(1 * time.Second)
+ }
+ Expect(exitCode).To(Equal(0))
})
It("podman healthcheck that should fail", func() {
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 31720ea04..3ba3c2bb3 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -659,6 +659,14 @@ USER mail`
Expect(isSharedOnly).Should(BeTrue())
})
+ It("podman run --mount type=bind,bind-nonrecursive", func() {
+ SkipIfRootless()
+ session := podmanTest.Podman([]string{"run", "--mount", "type=bind,bind-nonrecursive,slave,src=/,target=/host", fedoraMinimal, "findmnt", "-nR", "/host"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(1))
+ })
+
It("podman run --pod automatically", func() {
session := podmanTest.Podman([]string{"run", "--pod", "new:foobar", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/runlabel_test.go b/test/e2e/runlabel_test.go
index 5ef68603e..4e2cb501e 100644
--- a/test/e2e/runlabel_test.go
+++ b/test/e2e/runlabel_test.go
@@ -85,6 +85,7 @@ var _ = Describe("podman container runlabel", func() {
})
It("podman container runlabel global options", func() {
+ Skip("Test nonfunctional for podman-in-podman testing")
image := "podman-global-test:ls"
podmanTest.BuildImage(GlobalDockerfile, image, "false")
result := podmanTest.Podman([]string{"--syslog", "--log-level", "debug", "container", "runlabel", "RUN", image})