summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/README.md17
-rw-r--r--test/e2e/common_test.go20
-rw-r--r--test/e2e/export_test.go3
-rw-r--r--test/e2e/info_test.go6
-rw-r--r--test/e2e/libpod_suite_remoteclient_test.go2
-rw-r--r--test/e2e/libpod_suite_test.go2
-rw-r--r--test/e2e/prune_test.go20
-rw-r--r--test/e2e/ps_test.go7
-rw-r--r--test/e2e/run_signal_test.go6
-rw-r--r--test/e2e/runlabel_test.go11
-rw-r--r--test/e2e/volume_prune_test.go30
11 files changed, 89 insertions, 35 deletions
diff --git a/test/README.md b/test/README.md
index fd72ecd00..90dcdfe3d 100644
--- a/test/README.md
+++ b/test/README.md
@@ -34,27 +34,14 @@ between Ginkgo and the Go test framework.
## Installing dependencies
The dependencies for integration really consists of three things:
* ginkgo binary
-* ginkgo sources
-* gomega sources
The following instructions assume your GOPATH is ~/go. Adjust as needed for your
environment.
### Installing ginkgo
-Fetch and build ginkgo with the following command:
+Build ginkgo and install it under $GOPATH/bin with the following command:
```
-GOPATH=~/go go get -u github.com/onsi/ginkgo/ginkgo
-```
-Now install the ginkgo binary into your path:
-```
-install -D -m 755 "$GOPATH"/bin/ginkgo /usr/bin/
-```
-You now have a ginkgo binary and its sources in your GOPATH.
-
-### Install gomega sources
-The gomega sources can be simply installed with the command:
-```
-GOPATH=~/go go get github.com/onsi/gomega/...
+GOPATH=~/go make .install.ginkgo
```
# Integration Tests
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 308a6bf29..b22ead3fa 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -34,7 +34,7 @@ type PodmanTestIntegration struct {
ConmonBinary string
CrioRoot string
CNIConfigDir string
- RunCBinary string
+ OCIRuntime string
RunRoot string
StorageOptions string
SignaturePolicyPath string
@@ -136,12 +136,16 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
cgroupManager = "cgroupfs"
}
- runCBinary, err := exec.LookPath("runc")
- // If we cannot find the runc binary, setting to something static as we have no way
- // to return an error. The tests will fail and point out that the runc binary could
- // not be found nicely.
- if err != nil {
- runCBinary = "/usr/bin/runc"
+ ociRuntime := os.Getenv("OCI_RUNTIME")
+ if ociRuntime == "" {
+ var err error
+ ociRuntime, err = exec.LookPath("runc")
+ // If we cannot find the runc binary, setting to something static as we have no way
+ // to return an error. The tests will fail and point out that the runc binary could
+ // not be found nicely.
+ if err != nil {
+ ociRuntime = "/usr/bin/runc"
+ }
}
CNIConfigDir := "/etc/cni/net.d"
@@ -156,7 +160,7 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
ConmonBinary: conmonBinary,
CrioRoot: filepath.Join(tempDir, "crio"),
CNIConfigDir: CNIConfigDir,
- RunCBinary: runCBinary,
+ OCIRuntime: ociRuntime,
RunRoot: filepath.Join(tempDir, "crio-run"),
StorageOptions: storageOptions,
SignaturePolicyPath: filepath.Join(INTEGRATION_ROOT, "test/policy.json"),
diff --git a/test/e2e/export_test.go b/test/e2e/export_test.go
index de3f23667..dba0a2255 100644
--- a/test/e2e/export_test.go
+++ b/test/e2e/export_test.go
@@ -1,5 +1,3 @@
-// +build !remoteclient
-
package integration
import (
@@ -37,6 +35,7 @@ var _ = Describe("Podman export", func() {
})
It("podman export output flag", func() {
+ SkipIfRemote()
_, ec, cid := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go
index 2022dff1b..a50c27dda 100644
--- a/test/e2e/info_test.go
+++ b/test/e2e/info_test.go
@@ -35,6 +35,12 @@ var _ = Describe("Podman Info", func() {
It("podman info json output", func() {
session := podmanTest.Podman([]string{"info", "--format=json"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ })
+ It("podman system info json output", func() {
+ session := podmanTest.Podman([]string{"system", "info", "--format=json"})
session.Wait()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/libpod_suite_remoteclient_test.go b/test/e2e/libpod_suite_remoteclient_test.go
index 4b769a574..e6bc00397 100644
--- a/test/e2e/libpod_suite_remoteclient_test.go
+++ b/test/e2e/libpod_suite_remoteclient_test.go
@@ -164,7 +164,7 @@ func (p *PodmanTestIntegration) makeOptions(args []string) []string {
//MakeOptions assembles all the podman main options
func getVarlinkOptions(p *PodmanTestIntegration, args []string) []string {
podmanOptions := strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s --cgroup-manager %s",
- p.CrioRoot, p.RunRoot, p.RunCBinary, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager), " ")
+ p.CrioRoot, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager), " ")
if os.Getenv("HOOK_OPTION") != "" {
podmanOptions = append(podmanOptions, os.Getenv("HOOK_OPTION"))
}
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 1f218cbdf..4b4baa93c 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -207,7 +207,7 @@ func PodmanTestCreate(tempDir string) *PodmanTestIntegration {
//MakeOptions assembles all the podman main options
func (p *PodmanTestIntegration) makeOptions(args []string) []string {
podmanOptions := strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s --cgroup-manager %s",
- p.CrioRoot, p.RunRoot, p.RunCBinary, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager), " ")
+ p.CrioRoot, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager), " ")
if os.Getenv("HOOK_OPTION") != "" {
podmanOptions = append(podmanOptions, os.Getenv("HOOK_OPTION"))
}
diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go
index 50a279232..74cdc126f 100644
--- a/test/e2e/prune_test.go
+++ b/test/e2e/prune_test.go
@@ -1,5 +1,3 @@
-// +build !remoteclient
-
package integration
import (
@@ -41,6 +39,7 @@ var _ = Describe("Podman rm", func() {
})
It("podman container prune containers", func() {
+ SkipIfRemote()
top := podmanTest.RunTopContainer("")
top.WaitWithDefaultTimeout()
Expect(top.ExitCode()).To(Equal(0))
@@ -57,6 +56,7 @@ var _ = Describe("Podman rm", func() {
})
It("podman image prune none images", func() {
+ SkipIfRemote()
podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true")
none := podmanTest.Podman([]string{"images", "-a"})
@@ -74,10 +74,24 @@ var _ = Describe("Podman rm", func() {
Expect(none.ExitCode()).To(Equal(0))
hasNoneAfter, _ := after.GrepString("<none>")
Expect(hasNoneAfter).To(BeFalse())
+ Expect(len(after.OutputToStringArray()) > 1).To(BeTrue())
})
It("podman image prune unused images", func() {
- prune := podmanTest.Podman([]string{"image", "prune"})
+ prune := podmanTest.Podman([]string{"image", "prune", "-a"})
+ prune.WaitWithDefaultTimeout()
+ Expect(prune.ExitCode()).To(Equal(0))
+
+ images := podmanTest.Podman([]string{"images", "-a"})
+ images.WaitWithDefaultTimeout()
+ // all images are unused, so they all should be deleted!
+ Expect(len(images.OutputToStringArray())).To(Equal(0))
+ })
+
+ It("podman system image prune unused images", func() {
+ SkipIfRemote()
+ podmanTest.BuildImage(pruneImage, "alpine_bash:latest", "true")
+ prune := podmanTest.Podman([]string{"system", "prune", "-a", "--force"})
prune.WaitWithDefaultTimeout()
Expect(prune.ExitCode()).To(Equal(0))
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index bff2427d5..9b1c55bb4 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -7,6 +7,7 @@ import (
"os"
"regexp"
"sort"
+ "strings"
. "github.com/containers/libpod/test/utils"
"github.com/docker/go-units"
@@ -148,10 +149,12 @@ var _ = Describe("Podman ps", func() {
_, ec, _ := podmanTest.RunLsContainer("test1")
Expect(ec).To(Equal(0))
- result := podmanTest.Podman([]string{"ps", "-a", "--format", "\"table {{.ID}} {{.Image}} {{.Labels}}\""})
+ result := podmanTest.Podman([]string{"ps", "-a", "--format", "table {{.ID}} {{.Image}} {{.Labels}}"})
result.WaitWithDefaultTimeout()
+ Expect(strings.Contains(result.OutputToStringArray()[0], "table")).To(BeFalse())
+ Expect(strings.Contains(result.OutputToStringArray()[0], "ID")).To(BeTrue())
+ Expect(strings.Contains(result.OutputToStringArray()[1], "alpine:latest")).To(BeTrue())
Expect(result.ExitCode()).To(Equal(0))
- Expect(result.IsJSONOutputValid()).To(BeTrue())
})
It("podman ps ancestor filter flag", func() {
diff --git a/test/e2e/run_signal_test.go b/test/e2e/run_signal_test.go
index 9be8e7810..51c14602e 100644
--- a/test/e2e/run_signal_test.go
+++ b/test/e2e/run_signal_test.go
@@ -55,7 +55,7 @@ var _ = Describe("Podman run with --sig-proxy", func() {
_, pid := podmanTest.PodmanPID([]string{"run", "-it", "-v", fmt.Sprintf("%s:/h:Z", udsDir), fedoraMinimal, "bash", "-c", sigCatch})
- uds, _ := os.OpenFile(udsPath, os.O_RDONLY, 0600)
+ uds, _ := os.OpenFile(udsPath, os.O_RDONLY|syscall.O_NONBLOCK, 0600)
defer uds.Close()
// Wait for the script in the container to alert us that it is READY
@@ -73,7 +73,7 @@ var _ = Describe("Podman run with --sig-proxy", func() {
}
time.Sleep(1 * time.Second)
if counter == 15 {
- os.Exit(1)
+ Fail("Timed out waiting for READY from container")
}
counter++
}
@@ -99,7 +99,7 @@ var _ = Describe("Podman run with --sig-proxy", func() {
}
time.Sleep(1 * time.Second)
if counter == 15 {
- os.Exit(1)
+ Fail("timed out waiting for FOO from container")
}
counter++
}
diff --git a/test/e2e/runlabel_test.go b/test/e2e/runlabel_test.go
index 9b4f584b0..49b9e13d8 100644
--- a/test/e2e/runlabel_test.go
+++ b/test/e2e/runlabel_test.go
@@ -68,4 +68,15 @@ var _ = Describe("podman container runlabel", func() {
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
})
+ It("podman container runlabel bogus label should result in non-zero exit code", func() {
+ result := podmanTest.Podman([]string{"container", "runlabel", "RUN", ALPINE})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).ToNot(Equal(0))
+ })
+ It("podman container runlabel bogus label in remote image should result in non-zero exit", func() {
+ result := podmanTest.Podman([]string{"container", "runlabel", "RUN", "docker.io/library/ubuntu:latest"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).ToNot(Equal(0))
+
+ })
})
diff --git a/test/e2e/volume_prune_test.go b/test/e2e/volume_prune_test.go
index 008acc2a2..802f3fc4a 100644
--- a/test/e2e/volume_prune_test.go
+++ b/test/e2e/volume_prune_test.go
@@ -63,4 +63,34 @@ var _ = Describe("Podman volume prune", func() {
podmanTest.Cleanup()
})
+
+ It("podman system prune --volume", func() {
+ session := podmanTest.Podman([]string{"volume", "create"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"volume", "create"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"create", "-v", "myvol:/myvol", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"volume", "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(4))
+
+ session = podmanTest.Podman([]string{"system", "prune", "--force", "--volumes"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"volume", "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(2))
+
+ podmanTest.Cleanup()
+ })
})