summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/libpod_suite_test.go14
-rw-r--r--test/e2e/load_test.go116
-rw-r--r--test/e2e/mount_test.go64
-rw-r--r--test/e2e/port_test.go82
-rw-r--r--test/e2e/run_networking_test.go3
-rw-r--r--test/e2e/search_test.go67
6 files changed, 344 insertions, 2 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index d6263beb2..e6f110dad 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -39,11 +39,12 @@ var (
INTEGRATION_ROOT string
STORAGE_OPTIONS = "--storage-driver vfs"
ARTIFACT_DIR = "/tmp/.artifacts"
- CACHE_IMAGES = []string{"alpine", "busybox", fedoraMinimal}
+ CACHE_IMAGES = []string{"alpine", "busybox", fedoraMinimal, nginx}
RESTORE_IMAGES = []string{"alpine", "busybox"}
ALPINE = "docker.io/library/alpine:latest"
BB_GLIBC = "docker.io/library/busybox:glibc"
fedoraMinimal = "registry.fedoraproject.org/fedora-minimal:latest"
+ nginx = "docker.io/library/nginx:latest"
defaultWaitTimeout = 90
)
@@ -427,3 +428,14 @@ func (s *PodmanSession) LineInOuputStartsWith(term string) bool {
}
return false
}
+
+//LineInOutputContains returns true if a line in a
+// session output starts with the supplied string
+func (s *PodmanSession) LineInOuputContains(term string) bool {
+ for _, i := range s.OutputToStringArray() {
+ if strings.Contains(i, term) {
+ return true
+ }
+ }
+ return false
+}
diff --git a/test/e2e/load_test.go b/test/e2e/load_test.go
new file mode 100644
index 000000000..e36883b16
--- /dev/null
+++ b/test/e2e/load_test.go
@@ -0,0 +1,116 @@
+package integration
+
+import (
+ "os"
+ "path/filepath"
+
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+)
+
+var _ = Describe("Podman load", func() {
+ var (
+ tempdir string
+ err error
+ podmanTest PodmanTest
+ )
+
+ BeforeEach(func() {
+ tempdir, err = CreateTempDirInTempDir()
+ if err != nil {
+ os.Exit(1)
+ }
+ podmanTest = PodmanCreate(tempdir)
+ podmanTest.RestoreAllArtifacts()
+ })
+
+ AfterEach(func() {
+ podmanTest.Cleanup()
+ })
+
+ It("podman load input flag", func() {
+ outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
+
+ save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
+ save.WaitWithDefaultTimeout()
+ Expect(save.ExitCode()).To(Equal(0))
+
+ rmi := podmanTest.Podman([]string{"rmi", ALPINE})
+ rmi.WaitWithDefaultTimeout()
+ Expect(rmi.ExitCode()).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"load", "-i", outfile})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ })
+
+ It("podman load oci-archive image", func() {
+ outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
+
+ save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE})
+ save.WaitWithDefaultTimeout()
+ Expect(save.ExitCode()).To(Equal(0))
+
+ rmi := podmanTest.Podman([]string{"rmi", ALPINE})
+ rmi.WaitWithDefaultTimeout()
+ Expect(rmi.ExitCode()).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"load", "-i", outfile})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ })
+
+ It("podman load oci-archive with signature", func() {
+ outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
+
+ save := podmanTest.Podman([]string{"save", "-o", outfile, "--format", "oci-archive", ALPINE})
+ save.WaitWithDefaultTimeout()
+ Expect(save.ExitCode()).To(Equal(0))
+
+ rmi := podmanTest.Podman([]string{"rmi", ALPINE})
+ rmi.WaitWithDefaultTimeout()
+ Expect(rmi.ExitCode()).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"load", "--signature-policy", "/etc/containers/policy.json", "-i", outfile})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ })
+
+ It("podman load with quiet flag", func() {
+ outfile := filepath.Join(podmanTest.TempDir, "alpine.tar")
+
+ save := podmanTest.Podman([]string{"save", "-o", outfile, ALPINE})
+ save.WaitWithDefaultTimeout()
+ Expect(save.ExitCode()).To(Equal(0))
+
+ rmi := podmanTest.Podman([]string{"rmi", ALPINE})
+ rmi.WaitWithDefaultTimeout()
+ Expect(rmi.ExitCode()).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"load", "-q", "-i", outfile})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ })
+
+ It("podman load directory", func() {
+ outdir := filepath.Join(podmanTest.TempDir, "alpine")
+
+ save := podmanTest.Podman([]string{"save", "--format", "oci-dir", "-o", outdir, ALPINE})
+ save.WaitWithDefaultTimeout()
+ Expect(save.ExitCode()).To(Equal(0))
+
+ rmi := podmanTest.Podman([]string{"rmi", ALPINE})
+ rmi.WaitWithDefaultTimeout()
+ Expect(rmi.ExitCode()).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"load", "-i", outdir})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ })
+
+ It("podman load bogus file", func() {
+ save := podmanTest.Podman([]string{"load", "-i", "foobar.tar"})
+ save.WaitWithDefaultTimeout()
+ Expect(save.ExitCode()).ToNot(Equal(0))
+ })
+})
diff --git a/test/e2e/mount_test.go b/test/e2e/mount_test.go
new file mode 100644
index 000000000..cc1cc8edf
--- /dev/null
+++ b/test/e2e/mount_test.go
@@ -0,0 +1,64 @@
+package integration
+
+import (
+ "os"
+
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+)
+
+var _ = Describe("Podman mount", func() {
+ var (
+ tempdir string
+ err error
+ podmanTest PodmanTest
+ )
+
+ BeforeEach(func() {
+ tempdir, err = CreateTempDirInTempDir()
+ if err != nil {
+ os.Exit(1)
+ }
+ podmanTest = PodmanCreate(tempdir)
+ podmanTest.RestoreAllArtifacts()
+ })
+
+ AfterEach(func() {
+ podmanTest.Cleanup()
+ })
+
+ It("podman mount", func() {
+ setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(Equal(0))
+ cid := setup.OutputToString()
+
+ mount := podmanTest.Podman([]string{"mount", cid})
+ mount.WaitWithDefaultTimeout()
+ Expect(mount.ExitCode()).To(Equal(0))
+
+ umount := podmanTest.Podman([]string{"umount", cid})
+ umount.WaitWithDefaultTimeout()
+ Expect(umount.ExitCode()).To(Equal(0))
+ })
+
+ It("podman mount with json format", func() {
+ setup := podmanTest.Podman([]string{"create", ALPINE, "ls"})
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(Equal(0))
+ cid := setup.OutputToString()
+
+ mount := podmanTest.Podman([]string{"mount", cid})
+ mount.WaitWithDefaultTimeout()
+ Expect(mount.ExitCode()).To(Equal(0))
+
+ j := podmanTest.Podman([]string{"mount", "--format=json"})
+ j.WaitWithDefaultTimeout()
+ Expect(j.ExitCode()).To(Equal(0))
+ Expect(j.IsJSONOutputValid())
+
+ umount := podmanTest.Podman([]string{"umount", cid})
+ umount.WaitWithDefaultTimeout()
+ Expect(umount.ExitCode()).To(Equal(0))
+ })
+})
diff --git a/test/e2e/port_test.go b/test/e2e/port_test.go
new file mode 100644
index 000000000..963221253
--- /dev/null
+++ b/test/e2e/port_test.go
@@ -0,0 +1,82 @@
+package integration
+
+import (
+ "os"
+
+ "fmt"
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+ "strings"
+)
+
+var _ = Describe("Podman port", func() {
+ var (
+ tempdir string
+ err error
+ podmanTest PodmanTest
+ )
+
+ BeforeEach(func() {
+ tempdir, err = CreateTempDirInTempDir()
+ if err != nil {
+ os.Exit(1)
+ }
+ podmanTest = PodmanCreate(tempdir)
+ podmanTest.RestoreAllArtifacts()
+ })
+
+ AfterEach(func() {
+ podmanTest.Cleanup()
+
+ })
+
+ It("podman port all and latest", func() {
+ result := podmanTest.Podman([]string{"port", "-a", "-l"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).ToNot(Equal(0))
+ })
+
+ It("podman port all and extra", func() {
+ result := podmanTest.Podman([]string{"port", "-a", "foobar"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).ToNot(Equal(0))
+ })
+
+ It("podman port -l nginx", func() {
+ podmanTest.RestoreArtifact(nginx)
+ session := podmanTest.Podman([]string{"run", "-dt", "-P", "docker.io/library/nginx:latest"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"port", "-l"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ port := strings.Split(result.OutputToStringArray()[0], ":")[1]
+ Expect(result.LineInOuputStartsWith(fmt.Sprintf("80/udp -> 0.0.0.0:%s", port))).To(BeTrue())
+ Expect(result.LineInOuputStartsWith(fmt.Sprintf("80/tcp -> 0.0.0.0:%s", port))).To(BeTrue())
+ })
+
+ It("podman port -l port nginx", func() {
+ podmanTest.RestoreArtifact(nginx)
+ session := podmanTest.Podman([]string{"run", "-dt", "-P", "docker.io/library/nginx:latest"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"port", "-l", "80"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ port := strings.Split(result.OutputToStringArray()[0], ":")[1]
+ Expect(result.LineInOuputStartsWith(fmt.Sprintf("0.0.0.0:%s", port))).To(BeTrue())
+ })
+
+ It("podman port -a nginx", func() {
+ podmanTest.RestoreArtifact(nginx)
+ session := podmanTest.Podman([]string{"run", "-dt", "-P", "docker.io/library/nginx:latest"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"port", "-a"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ })
+})
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index e60da148d..68be154f5 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -68,7 +68,8 @@ var _ = Describe("Podman rmi", func() {
})
It("podman run network expose ports in image metadata", func() {
- session := podmanTest.Podman([]string{"run", "-dt", "-P", "docker.io/library/nginx:latest"})
+ podmanTest.RestoreArtifact(nginx)
+ session := podmanTest.Podman([]string{"run", "-dt", "-P", nginx})
session.Wait(90)
Expect(session.ExitCode()).To(Equal(0))
results := podmanTest.Podman([]string{"inspect", "-l"})
diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go
new file mode 100644
index 000000000..fbe5a4580
--- /dev/null
+++ b/test/e2e/search_test.go
@@ -0,0 +1,67 @@
+package integration
+
+import (
+ "os"
+
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+)
+
+var _ = Describe("Podman search", func() {
+ var (
+ tempdir string
+ err error
+ podmanTest PodmanTest
+ )
+
+ BeforeEach(func() {
+ tempdir, err = CreateTempDirInTempDir()
+ if err != nil {
+ os.Exit(1)
+ }
+ podmanTest = PodmanCreate(tempdir)
+ })
+
+ AfterEach(func() {
+ podmanTest.Cleanup()
+
+ })
+
+ It("podman search", func() {
+ search := podmanTest.Podman([]string{"search", "alpine"})
+ search.WaitWithDefaultTimeout()
+ Expect(search.ExitCode()).To(Equal(0))
+ Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
+ Expect(search.LineInOuputContains("docker.io/library/alpine")).To(BeTrue())
+ })
+
+ It("podman search registry flag", func() {
+ search := podmanTest.Podman([]string{"search", "--registry", "registry.fedoraproject.org", "fedora-minimal"})
+ search.WaitWithDefaultTimeout()
+ Expect(search.ExitCode()).To(Equal(0))
+ Expect(search.LineInOuputContains("fedoraproject.org/fedora-minimal")).To(BeTrue())
+ })
+
+ It("podman search format flag", func() {
+ search := podmanTest.Podman([]string{"search", "--format", "table {{.Index}} {{.Name}}", "alpine"})
+ search.WaitWithDefaultTimeout()
+ Expect(search.ExitCode()).To(Equal(0))
+ Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
+ Expect(search.LineInOuputContains("docker.io/library/alpine")).To(BeTrue())
+ })
+
+ It("podman search no-trunc flag", func() {
+ search := podmanTest.Podman([]string{"search", "alpine"})
+ search.WaitWithDefaultTimeout()
+ Expect(search.ExitCode()).To(Equal(0))
+ Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
+ Expect(search.LineInOuputContains("docker.io/library/alpine")).To(BeTrue())
+ })
+
+ It("podman search limit flag", func() {
+ search := podmanTest.Podman([]string{"search", "--limit", "3", "alpine"})
+ search.WaitWithDefaultTimeout()
+ Expect(search.ExitCode()).To(Equal(0))
+ Expect(len(search.OutputToStringArray())).To(Equal(4))
+ })
+})