summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/attach_test.go57
-rw-r--r--test/e2e/checkpoint_test.go17
-rw-r--r--test/e2e/commit_test.go20
-rw-r--r--test/e2e/common_test.go121
-rw-r--r--test/e2e/config.go1
-rw-r--r--test/e2e/config_amd64.go2
-rw-r--r--test/e2e/cp_test.go6
-rw-r--r--test/e2e/create_staticip_test.go7
-rw-r--r--test/e2e/create_test.go11
-rw-r--r--test/e2e/diff_test.go12
-rw-r--r--test/e2e/e2e.coverprofile18
-rw-r--r--test/e2e/events_test.go116
-rw-r--r--test/e2e/exec_test.go15
-rw-r--r--test/e2e/exists_test.go5
-rw-r--r--test/e2e/export_test.go21
-rw-r--r--test/e2e/generate_kube_test.go9
-rw-r--r--test/e2e/healthcheck_run_test.go182
-rw-r--r--test/e2e/history_test.go5
-rw-r--r--test/e2e/images_test.go84
-rw-r--r--test/e2e/import_test.go6
-rw-r--r--test/e2e/info_test.go8
-rw-r--r--test/e2e/inspect_test.go18
-rw-r--r--test/e2e/kill_test.go18
-rw-r--r--test/e2e/libpod_suite_remoteclient_test.go9
-rw-r--r--test/e2e/libpod_suite_test.go17
-rw-r--r--test/e2e/load_test.go12
-rw-r--r--test/e2e/logs_test.go44
-rw-r--r--test/e2e/mount_test.go21
-rw-r--r--test/e2e/namespace_test.go6
-rw-r--r--test/e2e/pause_test.go23
-rw-r--r--test/e2e/pod_create_test.go10
-rw-r--r--test/e2e/pod_infra_container_test.go38
-rw-r--r--test/e2e/pod_inspect_test.go6
-rw-r--r--test/e2e/pod_kill_test.go5
-rw-r--r--test/e2e/pod_pause_test.go7
-rw-r--r--test/e2e/pod_pod_namespaces.go5
-rw-r--r--test/e2e/pod_ps_test.go5
-rw-r--r--test/e2e/pod_restart_test.go6
-rw-r--r--test/e2e/pod_rm_test.go6
-rw-r--r--test/e2e/pod_start_test.go6
-rw-r--r--test/e2e/pod_stats_test.go7
-rw-r--r--test/e2e/pod_stop_test.go6
-rw-r--r--test/e2e/pod_top_test.go13
-rw-r--r--test/e2e/port_test.go18
-rw-r--r--test/e2e/prune_test.go6
-rw-r--r--test/e2e/ps_test.go42
-rw-r--r--test/e2e/pull_test.go5
-rw-r--r--test/e2e/push_test.go10
-rw-r--r--test/e2e/refresh_test.go6
-rw-r--r--test/e2e/restart_test.go21
-rw-r--r--test/e2e/rm_test.go31
-rw-r--r--test/e2e/rmi_test.go13
-rw-r--r--test/e2e/rootless_test.go23
-rw-r--r--test/e2e/run_cgroup_parent_test.go7
-rw-r--r--test/e2e/run_cleanup_test.go6
-rw-r--r--test/e2e/run_cpu_test.go12
-rw-r--r--test/e2e/run_device_test.go19
-rw-r--r--test/e2e/run_dns_test.go7
-rw-r--r--test/e2e/run_entrypoint_test.go6
-rw-r--r--test/e2e/run_exit_test.go9
-rw-r--r--test/e2e/run_memory_test.go7
-rw-r--r--test/e2e/run_networking_test.go11
-rw-r--r--test/e2e/run_ns_test.go8
-rw-r--r--test/e2e/run_passwd_test.go6
-rw-r--r--test/e2e/run_privileged_test.go9
-rw-r--r--test/e2e/run_restart_test.go6
-rw-r--r--test/e2e/run_selinux_test.go8
-rw-r--r--test/e2e/run_signal_test.go5
-rw-r--r--test/e2e/run_staticip_test.go7
-rw-r--r--test/e2e/run_test.go62
-rw-r--r--test/e2e/run_userns_test.go22
-rw-r--r--test/e2e/runlabel_test.go5
-rw-r--r--test/e2e/save_test.go6
-rw-r--r--test/e2e/search_test.go19
-rw-r--r--test/e2e/start_test.go16
-rw-r--r--test/e2e/stats_test.go6
-rw-r--r--test/e2e/stop_test.go43
-rw-r--r--test/e2e/system_df_test.go62
-rw-r--r--test/e2e/systemd_test.go7
-rw-r--r--test/e2e/tag_test.go6
-rw-r--r--test/e2e/top_test.go17
-rw-r--r--test/e2e/tree_test.go64
-rw-r--r--test/e2e/trust_test.go6
-rw-r--r--test/e2e/version_test.go25
-rw-r--r--test/e2e/volume_create_test.go6
-rw-r--r--test/e2e/volume_inspect_test.go6
-rw-r--r--test/e2e/volume_ls_test.go6
-rw-r--r--test/e2e/volume_prune_test.go6
-rw-r--r--test/e2e/volume_rm_test.go6
-rw-r--r--test/e2e/wait_test.go13
90 files changed, 1470 insertions, 258 deletions
diff --git a/test/e2e/attach_test.go b/test/e2e/attach_test.go
index 42866d5a1..a843fe7ff 100644
--- a/test/e2e/attach_test.go
+++ b/test/e2e/attach_test.go
@@ -3,8 +3,9 @@
package integration
import (
- "fmt"
"os"
+ "syscall"
+ "time"
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
@@ -24,14 +25,14 @@ var _ = Describe("Podman attach", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
})
@@ -51,6 +52,16 @@ var _ = Describe("Podman attach", func() {
Expect(results.ExitCode()).To(Equal(125))
})
+ It("podman container attach to non-running container", func() {
+ session := podmanTest.Podman([]string{"container", "create", "--name", "test1", "-d", "-i", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ results := podmanTest.Podman([]string{"container", "attach", "test1"})
+ results.WaitWithDefaultTimeout()
+ Expect(results.ExitCode()).To(Equal(125))
+ })
+
It("podman attach to multiple containers", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
@@ -64,4 +75,44 @@ var _ = Describe("Podman attach", func() {
results.WaitWithDefaultTimeout()
Expect(results.ExitCode()).To(Equal(125))
})
+
+ It("podman attach to a running container", func() {
+ session := podmanTest.Podman([]string{"run", "-d", "--name", "test", ALPINE, "/bin/sh", "-c", "while true; do echo test; sleep 1; done"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ results := podmanTest.Podman([]string{"attach", "test"})
+ time.Sleep(2 * time.Second)
+ results.Signal(syscall.SIGTSTP)
+ Expect(results.OutputToString()).To(ContainSubstring("test"))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+ })
+ It("podman attach to the latest container", func() {
+ session := podmanTest.Podman([]string{"run", "-d", "--name", "test1", ALPINE, "/bin/sh", "-c", "while true; do echo test1; sleep 1; done"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"run", "-d", "--name", "test2", ALPINE, "/bin/sh", "-c", "while true; do echo test2; sleep 1; done"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ results := podmanTest.Podman([]string{"attach", "-l"})
+ time.Sleep(2 * time.Second)
+ results.Signal(syscall.SIGTSTP)
+ Expect(results.OutputToString()).To(ContainSubstring("test2"))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
+ })
+
+ It("podman attach to a container with --sig-proxy set to false", func() {
+ session := podmanTest.Podman([]string{"run", "-d", "--name", "test", ALPINE, "/bin/sh", "-c", "while true; do echo test; sleep 1; done"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ results := podmanTest.Podman([]string{"attach", "--sig-proxy=false", "test"})
+ time.Sleep(2 * time.Second)
+ results.Signal(syscall.SIGTERM)
+ results.WaitWithDefaultTimeout()
+ Expect(results.OutputToString()).To(ContainSubstring("test"))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
+ })
})
diff --git a/test/e2e/checkpoint_test.go b/test/e2e/checkpoint_test.go
index 11332708b..5b549755e 100644
--- a/test/e2e/checkpoint_test.go
+++ b/test/e2e/checkpoint_test.go
@@ -3,9 +3,9 @@
package integration
import (
- "fmt"
"net"
"os"
+ "os/exec"
"github.com/containers/libpod/pkg/criu"
. "github.com/containers/libpod/test/utils"
@@ -26,7 +26,18 @@ var _ = Describe("Podman checkpoint", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
+ // Check if the runtime implements checkpointing. Currently only
+ // runc's checkpoint/restore implementation is supported.
+ cmd := exec.Command(podmanTest.OCIRuntime, "checkpoint", "-h")
+ if err := cmd.Start(); err != nil {
+ Skip("OCI runtime does not support checkpoint/restore")
+ }
+ if err := cmd.Wait(); err != nil {
+ Skip("OCI runtime does not support checkpoint/restore")
+ }
+
if !criu.CheckForCriu() {
Skip("CRIU is missing or too old.")
}
@@ -42,8 +53,8 @@ var _ = Describe("Podman checkpoint", func() {
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman checkpoint bogus container", func() {
diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go
index 34b218621..bf9c88de5 100644
--- a/test/e2e/commit_test.go
+++ b/test/e2e/commit_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,14 @@ var _ = Describe("Podman commit", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
})
@@ -50,6 +49,21 @@ var _ = Describe("Podman commit", func() {
Expect(StringInSlice("foobar.com/test1-image:latest", data[0].RepoTags)).To(BeTrue())
})
+ It("podman container commit container", func() {
+ _, ec, _ := podmanTest.RunLsContainer("test1")
+ Expect(ec).To(Equal(0))
+ Expect(podmanTest.NumberOfContainers()).To(Equal(1))
+
+ session := podmanTest.Podman([]string{"container", "commit", "test1", "foobar.com/test1-image:latest"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ check := podmanTest.Podman([]string{"image", "inspect", "foobar.com/test1-image:latest"})
+ check.WaitWithDefaultTimeout()
+ data := check.InspectImageJSON()
+ Expect(StringInSlice("foobar.com/test1-image:latest", data[0].RepoTags)).To(BeTrue())
+ })
+
It("podman commit container with message", func() {
_, ec, _ := podmanTest.RunLsContainer("test1")
Expect(ec).To(Equal(0))
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index b22ead3fa..b20b3b37e 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -3,12 +3,17 @@ package integration
import (
"encoding/json"
"fmt"
+ "github.com/containers/libpod/pkg/rootless"
+ "io/ioutil"
"os"
"os/exec"
"path/filepath"
+ "sort"
"strings"
"testing"
+ "github.com/containers/storage"
+
"github.com/containers/libpod/pkg/inspect"
. "github.com/containers/libpod/test/utils"
"github.com/containers/storage/pkg/reexec"
@@ -40,13 +45,33 @@ type PodmanTestIntegration struct {
SignaturePolicyPath string
CgroupManager string
Host HostOS
+ Timings []string
+ TmpDir string
}
+var LockTmpDir string
+
// PodmanSessionIntegration sturct for command line session
type PodmanSessionIntegration struct {
*PodmanSession
}
+type testResult struct {
+ name string
+ length float64
+}
+
+type testResultsSorted []testResult
+
+func (a testResultsSorted) Len() int { return len(a) }
+func (a testResultsSorted) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
+
+type testResultsSortedLength struct{ testResultsSorted }
+
+func (a testResultsSorted) Less(i, j int) bool { return a[i].length < a[j].length }
+
+var testResults []testResult
+
// TestLibpod ginkgo master function
func TestLibpod(t *testing.T) {
if reexec.Init() {
@@ -60,7 +85,7 @@ func TestLibpod(t *testing.T) {
RunSpecs(t, "Libpod Suite")
}
-var _ = BeforeSuite(func() {
+var _ = SynchronizedBeforeSuite(func() []byte {
//Cache images
cwd, _ := os.Getwd()
INTEGRATION_ROOT = filepath.Join(cwd, "../../")
@@ -72,6 +97,7 @@ var _ = BeforeSuite(func() {
os.Exit(1)
}
}
+
for _, image := range CACHE_IMAGES {
if err := podman.CreateArtifact(image); err != nil {
fmt.Printf("%q\n", err)
@@ -92,6 +118,68 @@ var _ = BeforeSuite(func() {
}
f.Close()
}
+ path, err := ioutil.TempDir("", "libpodlock")
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+ return []byte(path)
+}, func(data []byte) {
+ LockTmpDir = string(data)
+})
+
+func (p *PodmanTestIntegration) Setup() {
+ cwd, _ := os.Getwd()
+ INTEGRATION_ROOT = filepath.Join(cwd, "../../")
+ p.ArtifactPath = ARTIFACT_DIR
+}
+
+//var _ = BeforeSuite(func() {
+// cwd, _ := os.Getwd()
+// INTEGRATION_ROOT = filepath.Join(cwd, "../../")
+// podman := PodmanTestCreate("/tmp")
+// podman.ArtifactPath = ARTIFACT_DIR
+// if _, err := os.Stat(ARTIFACT_DIR); os.IsNotExist(err) {
+// if err = os.Mkdir(ARTIFACT_DIR, 0777); err != nil {
+// fmt.Printf("%q\n", err)
+// os.Exit(1)
+// }
+// }
+//})
+// for _, image := range CACHE_IMAGES {
+// if err := podman.CreateArtifact(image); err != nil {
+// fmt.Printf("%q\n", err)
+// os.Exit(1)
+// }
+// }
+// host := GetHostDistributionInfo()
+// if host.Distribution == "rhel" && strings.HasPrefix(host.Version, "7") {
+// f, err := os.OpenFile("/proc/sys/user/max_user_namespaces", os.O_WRONLY, 0644)
+// if err != nil {
+// fmt.Println("Unable to enable userspace on RHEL 7")
+// os.Exit(1)
+// }
+// _, err = f.WriteString("15000")
+// if err != nil {
+// fmt.Println("Unable to enable userspace on RHEL 7")
+// os.Exit(1)
+// }
+// f.Close()
+// }
+// path, err := ioutil.TempDir("", "libpodlock")
+// if err != nil {
+// fmt.Println(err)
+// os.Exit(1)
+// }
+// LockTmpDir = path
+//})
+
+var _ = AfterSuite(func() {
+ sort.Sort(testResultsSortedLength{testResults})
+ fmt.Println("integration timing results")
+ for _, result := range testResults {
+ fmt.Printf("%s\t\t%f\n", result.name, result.length)
+ }
})
// PodmanTestCreate creates a PodmanTestIntegration instance for the tests
@@ -126,7 +214,11 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
if os.Getenv("STORAGE_OPTIONS") != "" {
storageOptions = os.Getenv("STORAGE_OPTIONS")
}
+
cgroupManager := CGROUP_MANAGER
+ if rootless.IsRootless() {
+ cgroupManager = "cgroupfs"
+ }
if os.Getenv("CGROUP_MANAGER") != "" {
cgroupManager = os.Getenv("CGROUP_MANAGER")
}
@@ -147,7 +239,7 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
ociRuntime = "/usr/bin/runc"
}
}
-
+ os.Setenv("DISABLE_HC_SYSTEMD", "true")
CNIConfigDir := "/etc/cni/net.d"
p := &PodmanTestIntegration{
@@ -159,6 +251,7 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
},
ConmonBinary: conmonBinary,
CrioRoot: filepath.Join(tempDir, "crio"),
+ TmpDir: tempDir,
CNIConfigDir: CNIConfigDir,
OCIRuntime: ociRuntime,
RunRoot: filepath.Join(tempDir, "crio-run"),
@@ -220,3 +313,27 @@ func (s *PodmanSessionIntegration) InspectImageJSON() []inspect.ImageData {
Expect(err).To(BeNil())
return i
}
+
+// InspectContainer returns a container's inspect data in JSON format
+func (p *PodmanTestIntegration) InspectContainer(name string) []inspect.ContainerData {
+ cmd := []string{"inspect", name}
+ session := p.Podman(cmd)
+ session.WaitWithDefaultTimeout()
+ return session.InspectContainerToJSON()
+}
+
+func processTestResult(f GinkgoTestDescription) {
+ tr := testResult{length: f.Duration.Seconds(), name: f.TestText}
+ testResults = append(testResults, tr)
+}
+
+func GetPortLock(port string) storage.Locker {
+ lockFile := filepath.Join(LockTmpDir, port)
+ lock, err := storage.GetLockfile(lockFile)
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+ lock.Lock()
+ return lock
+}
diff --git a/test/e2e/config.go b/test/e2e/config.go
index 8116d993b..3fdb9e116 100644
--- a/test/e2e/config.go
+++ b/test/e2e/config.go
@@ -6,4 +6,5 @@ var (
ALPINE = "docker.io/library/alpine:latest"
infra = "k8s.gcr.io/pause:3.1"
BB = "docker.io/library/busybox:latest"
+ healthcheck = "docker.io/libpod/alpine_healthcheck:latest"
)
diff --git a/test/e2e/config_amd64.go b/test/e2e/config_amd64.go
index 3459bea6d..d02de7a6e 100644
--- a/test/e2e/config_amd64.go
+++ b/test/e2e/config_amd64.go
@@ -3,7 +3,7 @@ package integration
var (
STORAGE_OPTIONS = "--storage-driver vfs"
ROOTLESS_STORAGE_OPTIONS = "--storage-driver vfs"
- CACHE_IMAGES = []string{ALPINE, BB, fedoraMinimal, nginx, redis, registry, infra, labels}
+ CACHE_IMAGES = []string{ALPINE, BB, fedoraMinimal, nginx, redis, registry, infra, labels, healthcheck}
nginx = "quay.io/libpod/alpine_nginx:latest"
BB_GLIBC = "docker.io/library/busybox:glibc"
registry = "docker.io/library/registry:2"
diff --git a/test/e2e/cp_test.go b/test/e2e/cp_test.go
index e1e760ee0..f89865264 100644
--- a/test/e2e/cp_test.go
+++ b/test/e2e/cp_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"io/ioutil"
"os"
"os/exec"
@@ -27,14 +26,15 @@ var _ = Describe("Podman cp", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman cp file", func() {
diff --git a/test/e2e/create_staticip_test.go b/test/e2e/create_staticip_test.go
index 9bdc30342..6c4ca1cb8 100644
--- a/test/e2e/create_staticip_test.go
+++ b/test/e2e/create_staticip_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -19,11 +18,13 @@ var _ = Describe("Podman create with --ip flag", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
// Cleanup the CNI networks used by the tests
os.RemoveAll("/var/lib/cni/networks/podman")
@@ -32,8 +33,8 @@ var _ = Describe("Podman create with --ip flag", func() {
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("Podman create --ip with garbage address", func() {
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index 9a526b778..6ed5ad2d8 100644
--- a/test/e2e/create_test.go
+++ b/test/e2e/create_test.go
@@ -25,14 +25,14 @@ var _ = Describe("Podman create", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
})
@@ -56,6 +56,13 @@ var _ = Describe("Podman create", func() {
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
})
+ It("podman container create container based on a remote image", func() {
+ session := podmanTest.Podman([]string{"container", "create", BB_GLIBC, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainers()).To(Equal(1))
+ })
+
It("podman create using short options", func() {
session := podmanTest.Podman([]string{"create", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/diff_test.go b/test/e2e/diff_test.go
index 94e150467..fba65823e 100644
--- a/test/e2e/diff_test.go
+++ b/test/e2e/diff_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
"sort"
@@ -25,14 +24,14 @@ var _ = Describe("Podman diff", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
})
@@ -43,6 +42,13 @@ var _ = Describe("Podman diff", func() {
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
})
+ It("podman container diff of image", func() {
+ session := podmanTest.Podman([]string{"container", "diff", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
+ })
+
It("podman diff bogus image", func() {
session := podmanTest.Podman([]string{"diff", "1234"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/e2e.coverprofile b/test/e2e/e2e.coverprofile
index b5382604f..d413679ea 100644
--- a/test/e2e/e2e.coverprofile
+++ b/test/e2e/e2e.coverprofile
@@ -1,11 +1,11 @@
mode: atomic
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:14.46,21.20 2 1
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:31.2,31.19 1 1
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:38.2,38.53 1 1
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:65.2,65.52 1 1
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:21.20,23.17 2 2
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:26.3,28.36 3 2
+github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:14.46,21.20 2 3
+github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:32.2,32.19 1 3
+github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:39.2,39.53 1 3
+github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:66.2,66.52 1 3
+github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:21.20,23.17 2 6
+github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:26.3,29.36 4 6
github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:23.17,25.4 1 0
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:31.19,36.3 4 2
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:38.53,63.3 20 1
-github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:65.52,90.3 20 1
+github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:32.19,37.3 3 6
+github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:39.53,64.3 20 3
+github.com/containers/libpod/test/e2e/pod_pod_namespaces.go:66.52,91.3 20 3 \ No newline at end of file
diff --git a/test/e2e/events_test.go b/test/e2e/events_test.go
new file mode 100644
index 000000000..321d93757
--- /dev/null
+++ b/test/e2e/events_test.go
@@ -0,0 +1,116 @@
+package integration
+
+import (
+ "fmt"
+ "os"
+ "strings"
+
+ . "github.com/containers/libpod/test/utils"
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+)
+
+var _ = Describe("Podman events", func() {
+ var (
+ tempdir string
+ err error
+ podmanTest *PodmanTestIntegration
+ )
+
+ BeforeEach(func() {
+ tempdir, err = CreateTempDirInTempDir()
+ if err != nil {
+ os.Exit(1)
+ }
+ podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.RestoreAllArtifacts()
+ })
+
+ AfterEach(func() {
+ podmanTest.Cleanup()
+ f := CurrentGinkgoTestDescription()
+ timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
+ GinkgoWriter.Write([]byte(timedResult))
+
+ })
+
+ // For most, all, of these tests we do not "live" test following a log because it may make a fragile test
+ // system more complex. Instead we run the "events" and then verify that the events are processed correctly.
+ // Perhaps a future version of this test would put events in a go func and send output back over a channel
+ // while events occur.
+ It("podman events", func() {
+ _, ec, _ := podmanTest.RunLsContainer("")
+ Expect(ec).To(Equal(0))
+ result := podmanTest.Podman([]string{"events", "--stream=false"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(BeZero())
+ })
+
+ It("podman events with an event filter", func() {
+ SkipIfRemote()
+ _, ec, _ := podmanTest.RunLsContainer("")
+ Expect(ec).To(Equal(0))
+ result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "event=start"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(len(result.OutputToStringArray())).To(Equal(1))
+ })
+
+ It("podman events with an event filter and container=cid", func() {
+ SkipIfRemote()
+ _, ec, cid := podmanTest.RunLsContainer("")
+ Expect(ec).To(Equal(0))
+ _, ec2, cid2 := podmanTest.RunLsContainer("")
+ Expect(ec2).To(Equal(0))
+ result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "event=start", "--filter", fmt.Sprintf("container=%s", cid)})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(len(result.OutputToStringArray())).To(Equal(1))
+ Expect(!strings.Contains(result.OutputToString(), cid2))
+ })
+
+ It("podman events with a type", func() {
+ SkipIfRemote()
+ _, ec, _ := podmanTest.RunLsContainer("")
+ Expect(ec).To(Equal(0))
+ result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "type=pod"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(len(result.OutputToStringArray())).To(Equal(0))
+ })
+
+ It("podman events with a type", func() {
+ SkipIfRemote()
+ setup := podmanTest.Podman([]string{"run", "-dt", "--pod", "new:foobar", ALPINE, "top"})
+ setup.WaitWithDefaultTimeout()
+ stop := podmanTest.Podman([]string{"pod", "stop", "foobar"})
+ stop.WaitWithDefaultTimeout()
+ Expect(stop.ExitCode()).To(Equal(0))
+ Expect(setup.ExitCode()).To(Equal(0))
+ result := podmanTest.Podman([]string{"events", "--stream=false", "--filter", "type=pod"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ fmt.Println(result.OutputToStringArray())
+ Expect(len(result.OutputToStringArray())).To(Equal(2))
+ })
+
+ It("podman events --since", func() {
+ _, ec, _ := podmanTest.RunLsContainer("")
+ Expect(ec).To(Equal(0))
+ result := podmanTest.Podman([]string{"events", "--stream=false", "--since", "1m"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(BeZero())
+ })
+
+ It("podman events --until", func() {
+ _, ec, _ := podmanTest.RunLsContainer("")
+ Expect(ec).To(Equal(0))
+ test := podmanTest.Podman([]string{"events", "--help"})
+ test.WaitWithDefaultTimeout()
+ fmt.Println(test.OutputToStringArray())
+ result := podmanTest.Podman([]string{"events", "--stream=false", "--since", "1h"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(BeZero())
+ })
+
+})
diff --git a/test/e2e/exec_test.go b/test/e2e/exec_test.go
index 5839b364d..2a10e52b1 100644
--- a/test/e2e/exec_test.go
+++ b/test/e2e/exec_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,14 @@ var _ = Describe("Podman exec", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
})
@@ -57,6 +56,16 @@ var _ = Describe("Podman exec", func() {
Expect(session.ExitCode()).To(Equal(0))
})
+ It("podman container exec simple command", func() {
+ setup := podmanTest.RunTopContainer("test1")
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(Equal(0))
+
+ session := podmanTest.Podman([]string{"container", "exec", "test1", "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
It("podman exec simple command using latest", func() {
setup := podmanTest.RunTopContainer("test1")
setup.WaitWithDefaultTimeout()
diff --git a/test/e2e/exists_test.go b/test/e2e/exists_test.go
index c4b5e4968..71c6c1820 100644
--- a/test/e2e/exists_test.go
+++ b/test/e2e/exists_test.go
@@ -1,7 +1,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -22,14 +21,14 @@ var _ = Describe("Podman image|container exists", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
})
diff --git a/test/e2e/export_test.go b/test/e2e/export_test.go
index dba0a2255..71ddb518a 100644
--- a/test/e2e/export_test.go
+++ b/test/e2e/export_test.go
@@ -1,7 +1,6 @@
package integration
import (
- "fmt"
"os"
"path/filepath"
@@ -23,14 +22,14 @@ var _ = Describe("Podman export", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
})
@@ -50,6 +49,22 @@ var _ = Describe("Podman export", func() {
Expect(err).To(BeNil())
})
+ It("podman container export output flag", func() {
+ SkipIfRemote()
+ _, ec, cid := podmanTest.RunLsContainer("")
+ Expect(ec).To(Equal(0))
+
+ outfile := filepath.Join(podmanTest.TempDir, "container.tar")
+ result := podmanTest.Podman([]string{"container", "export", "-o", outfile, cid})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ _, err := os.Stat(outfile)
+ Expect(err).To(BeNil())
+
+ err = os.Remove(outfile)
+ Expect(err).To(BeNil())
+ })
+
It("podman export bad filename", func() {
_, ec, cid := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index 94e02dc55..5bcf3b347 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -25,14 +24,14 @@ var _ = Describe("Podman generate kube", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
})
@@ -49,6 +48,7 @@ var _ = Describe("Podman generate kube", func() {
})
It("podman generate kube on container", func() {
+ SkipIfRootless()
session := podmanTest.RunTopContainer("top")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -62,6 +62,7 @@ var _ = Describe("Podman generate kube", func() {
})
It("podman generate service kube on container", func() {
+ SkipIfRootless()
session := podmanTest.RunTopContainer("top")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -75,6 +76,7 @@ var _ = Describe("Podman generate kube", func() {
})
It("podman generate kube on pod", func() {
+ SkipIfRootless()
_, rc, _ := podmanTest.CreatePod("toppod")
Expect(rc).To(Equal(0))
@@ -91,6 +93,7 @@ var _ = Describe("Podman generate kube", func() {
})
It("podman generate service kube on pod", func() {
+ SkipIfRootless()
_, rc, _ := podmanTest.CreatePod("toppod")
Expect(rc).To(Equal(0))
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go
new file mode 100644
index 000000000..cd2365ce7
--- /dev/null
+++ b/test/e2e/healthcheck_run_test.go
@@ -0,0 +1,182 @@
+// +build !remoteclient
+
+package integration
+
+import (
+ "fmt"
+ "os"
+
+ . "github.com/containers/libpod/test/utils"
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+)
+
+var _ = Describe("Podman healthcheck run", func() {
+ var (
+ tempdir string
+ err error
+ podmanTest *PodmanTestIntegration
+ )
+
+ BeforeEach(func() {
+ tempdir, err = CreateTempDirInTempDir()
+ if err != nil {
+ os.Exit(1)
+ }
+ podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.RestoreAllArtifacts()
+ })
+
+ AfterEach(func() {
+ podmanTest.Cleanup()
+ f := CurrentGinkgoTestDescription()
+ timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
+ GinkgoWriter.Write([]byte(timedResult))
+
+ })
+
+ It("podman healthcheck run bogus container", func() {
+ session := podmanTest.Podman([]string{"healthcheck", "run", "foobar"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Not(Equal(0)))
+ })
+
+ It("podman healthcheck on valid container", func() {
+ SkipIfRootless()
+ podmanTest.RestoreArtifact(healthcheck)
+ 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))
+ })
+
+ It("podman healthcheck that should fail", func() {
+ session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "docker.io/libpod/badhealthcheck:latest"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
+ hc.WaitWithDefaultTimeout()
+ Expect(hc.ExitCode()).To(Equal(1))
+ })
+
+ It("podman healthcheck on stopped container", func() {
+ podmanTest.RestoreArtifact(healthcheck)
+ session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", healthcheck, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
+ hc.WaitWithDefaultTimeout()
+ Expect(hc.ExitCode()).To(Equal(125))
+ })
+
+ It("podman healthcheck on container without healthcheck", func() {
+ session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
+ hc.WaitWithDefaultTimeout()
+ Expect(hc.ExitCode()).To(Equal(125))
+ })
+
+ It("podman healthcheck should be starting", func() {
+ session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "--healthcheck-retries", "2", "--healthcheck-command", "\"CMD-SHELL ls /foo || exit 1\"", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ inspect := podmanTest.InspectContainer("hc")
+ Expect(inspect[0].State.Healthcheck.Status).To(Equal("starting"))
+ })
+
+ It("podman healthcheck failed checks in start-period should not change status", func() {
+ session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "--healthcheck-start-period", "2m", "--healthcheck-retries", "2", "--healthcheck-command", "\"CMD-SHELL ls /foo || exit 1\"", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
+ hc.WaitWithDefaultTimeout()
+ Expect(hc.ExitCode()).To(Equal(1))
+
+ hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
+ hc.WaitWithDefaultTimeout()
+ Expect(hc.ExitCode()).To(Equal(1))
+
+ hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
+ hc.WaitWithDefaultTimeout()
+ Expect(hc.ExitCode()).To(Equal(1))
+
+ inspect := podmanTest.InspectContainer("hc")
+ Expect(inspect[0].State.Healthcheck.Status).To(Equal("starting"))
+ })
+
+ It("podman healthcheck failed checks must reach retries before unhealthy ", func() {
+ session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "--healthcheck-retries", "2", "--healthcheck-command", "\"CMD-SHELL ls /foo || exit 1\"", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
+ hc.WaitWithDefaultTimeout()
+ Expect(hc.ExitCode()).To(Equal(1))
+
+ inspect := podmanTest.InspectContainer("hc")
+ Expect(inspect[0].State.Healthcheck.Status).To(Equal("starting"))
+
+ hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
+ hc.WaitWithDefaultTimeout()
+ Expect(hc.ExitCode()).To(Equal(1))
+
+ inspect = podmanTest.InspectContainer("hc")
+ Expect(inspect[0].State.Healthcheck.Status).To(Equal("unhealthy"))
+
+ })
+
+ It("podman healthcheck good check results in healthy even in start-period", func() {
+ SkipIfRootless()
+ session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "--healthcheck-start-period", "2m", "--healthcheck-retries", "2", "--healthcheck-command", "\"CMD-SHELL\" \"ls\" \"||\" \"exit\" \"1\"", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
+ hc.WaitWithDefaultTimeout()
+ Expect(hc.ExitCode()).To(Equal(0))
+
+ inspect := podmanTest.InspectContainer("hc")
+ Expect(inspect[0].State.Healthcheck.Status).To(Equal("healthy"))
+ })
+
+ It("podman healthcheck single healthy result changes failed to healthy", func() {
+ SkipIfRootless()
+ session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", "--healthcheck-retries", "2", "--healthcheck-command", "\"CMD-SHELL\" \"ls\" \"/foo\" \"||\" \"exit\" \"1\"", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
+ hc.WaitWithDefaultTimeout()
+ Expect(hc.ExitCode()).To(Equal(1))
+
+ inspect := podmanTest.InspectContainer("hc")
+ Expect(inspect[0].State.Healthcheck.Status).To(Equal("starting"))
+
+ hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
+ hc.WaitWithDefaultTimeout()
+ Expect(hc.ExitCode()).To(Equal(1))
+
+ inspect = podmanTest.InspectContainer("hc")
+ Expect(inspect[0].State.Healthcheck.Status).To(Equal("unhealthy"))
+
+ foo := podmanTest.Podman([]string{"exec", "hc", "touch", "/foo"})
+ foo.WaitWithDefaultTimeout()
+ Expect(foo.ExitCode()).To(BeZero())
+
+ hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
+ hc.WaitWithDefaultTimeout()
+ Expect(hc.ExitCode()).To(Equal(0))
+
+ inspect = podmanTest.InspectContainer("hc")
+ Expect(inspect[0].State.Healthcheck.Status).To(Equal("healthy"))
+ })
+})
diff --git a/test/e2e/history_test.go b/test/e2e/history_test.go
index 9bec9ad13..9e519dd9c 100644
--- a/test/e2e/history_test.go
+++ b/test/e2e/history_test.go
@@ -1,7 +1,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -22,14 +21,14 @@ var _ = Describe("Podman history", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
})
diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go
index 595084403..a253dff63 100644
--- a/test/e2e/images_test.go
+++ b/test/e2e/images_test.go
@@ -24,14 +24,14 @@ var _ = Describe("Podman images", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
})
It("podman images", func() {
@@ -43,6 +43,15 @@ var _ = Describe("Podman images", func() {
Expect(session.LineInOuputStartsWith("docker.io/library/busybox")).To(BeTrue())
})
+ It("podman image List", func() {
+ session := podmanTest.Podman([]string{"image", "list"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 2))
+ Expect(session.LineInOuputStartsWith("docker.io/library/alpine")).To(BeTrue())
+ Expect(session.LineInOuputStartsWith("docker.io/library/busybox")).To(BeTrue())
+ })
+
It("podman images with multiple tags", func() {
// tag "docker.io/library/alpine:latest" to "foo:{a,b,c}"
session := podmanTest.Podman([]string{"tag", ALPINE, "foo:a", "foo:b", "foo:c"})
@@ -103,6 +112,45 @@ var _ = Describe("Podman images", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
Expect(len(session.OutputToStringArray())).To(Equal(1))
+
+ session = podmanTest.Podman([]string{"tag", ALPINE, "foo:a"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"tag", BB, "foo:b"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"images", "-q", "foo"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(2))
+ })
+
+ It("podman images filter reference", func() {
+ if podmanTest.RemoteTest {
+ Skip("Does not work on remote client")
+ }
+ result := podmanTest.Podman([]string{"images", "-q", "-f", "reference=docker.io*"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(len(result.OutputToStringArray())).To(Equal(2))
+
+ retapline := podmanTest.Podman([]string{"images", "-f", "reference=a*pine"})
+ retapline.WaitWithDefaultTimeout()
+ Expect(retapline.ExitCode()).To(Equal(0))
+ Expect(len(retapline.OutputToStringArray())).To(Equal(2))
+ Expect(retapline.LineInOutputContains("alpine"))
+
+ retapline = podmanTest.Podman([]string{"images", "-f", "reference=alpine"})
+ retapline.WaitWithDefaultTimeout()
+ Expect(retapline.ExitCode()).To(Equal(0))
+ Expect(len(retapline.OutputToStringArray())).To(Equal(2))
+ Expect(retapline.LineInOutputContains("alpine"))
+
+ retnone := podmanTest.Podman([]string{"images", "-q", "-f", "reference=bogus"})
+ retnone.WaitWithDefaultTimeout()
+ Expect(retnone.ExitCode()).To(Equal(0))
+ Expect(len(retnone.OutputToStringArray())).To(Equal(0))
})
It("podman images filter before image", func() {
@@ -135,6 +183,23 @@ var _ = Describe("Podman images", func() {
Expect(len(result.OutputToStringArray())).To(Equal(1))
})
+ It("podman image list filter after image", func() {
+ if podmanTest.RemoteTest {
+ Skip("Does not work on remote client")
+ }
+ rmi := podmanTest.Podman([]string{"image", "rm", "busybox"})
+ rmi.WaitWithDefaultTimeout()
+ Expect(rmi.ExitCode()).To(Equal(0))
+
+ dockerfile := `FROM docker.io/library/alpine:latest
+`
+ podmanTest.BuildImage(dockerfile, "foobar.com/before:latest", "false")
+ result := podmanTest.Podman([]string{"image", "list", "-q", "-f", "after=docker.io/library/alpine:latest"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(len(result.OutputToStringArray())).To(Equal(1))
+ })
+
It("podman images filter dangling", func() {
if podmanTest.RemoteTest {
Skip("Does not work on remote client")
@@ -164,6 +229,21 @@ var _ = Describe("Podman images", func() {
Expect(result.ExitCode()).To(Equal(0))
})
+ It("podman check for image with sha256: prefix", func() {
+ if podmanTest.RemoteTest {
+ Skip("Does not work on remote client")
+ }
+ session := podmanTest.Podman([]string{"image", "inspect", "--format=json", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.IsJSONOutputValid()).To(BeTrue())
+ imageData := session.InspectImageJSON()
+
+ result := podmanTest.Podman([]string{"image", "ls", fmt.Sprintf("sha256:%s", imageData[0].ID)})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ })
+
It("podman images sort by tag", func() {
session := podmanTest.Podman([]string{"images", "--sort", "tag", "--format={{.Tag}}"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/import_test.go b/test/e2e/import_test.go
index dc7451f7b..e819d819c 100644
--- a/test/e2e/import_test.go
+++ b/test/e2e/import_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
"path/filepath"
@@ -25,14 +24,15 @@ var _ = Describe("Podman import", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman import with source and reference", func() {
diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go
index a50c27dda..c960fb311 100644
--- a/test/e2e/info_test.go
+++ b/test/e2e/info_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,13 +23,14 @@ var _ = Describe("Podman Info", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman info json output", func() {
@@ -41,7 +41,7 @@ var _ = Describe("Podman Info", func() {
})
It("podman system info json output", func() {
session := podmanTest.Podman([]string{"system", "info", "--format=json"})
- session.Wait()
+ session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
})
diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go
index e5c471bf9..34328828f 100644
--- a/test/e2e/inspect_test.go
+++ b/test/e2e/inspect_test.go
@@ -1,7 +1,6 @@
package integration
import (
- "fmt"
"os"
"strings"
@@ -23,14 +22,15 @@ var _ = Describe("Podman inspect", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman inspect alpine image", func() {
@@ -57,7 +57,7 @@ var _ = Describe("Podman inspect", func() {
result := podmanTest.Podman([]string{"images", "-q", "--no-trunc", ALPINE})
result.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- Expect(strings.Trim(result.OutputToString(), "sha256:")).To(Equal(session.OutputToString()))
+ Expect(strings.Contains(result.OutputToString(), session.OutputToString()))
})
It("podman inspect specified type", func() {
@@ -66,6 +66,16 @@ var _ = Describe("Podman inspect", func() {
Expect(session.ExitCode()).To(Equal(0))
})
+ It("podman inspect container with GO format for ConmonPidFile", func() {
+ SkipIfRemote()
+ session, ec, _ := podmanTest.RunLsContainer("test1")
+ Expect(ec).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"inspect", "--format", "{{.ConmonPidFile}}", "test1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
It("podman inspect container with size", func() {
SkipIfRemote()
_, ec, _ := podmanTest.RunLsContainer("")
diff --git a/test/e2e/kill_test.go b/test/e2e/kill_test.go
index 5f1f5f4c1..618ca5aa0 100644
--- a/test/e2e/kill_test.go
+++ b/test/e2e/kill_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,14 @@ var _ = Describe("Podman kill", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
})
@@ -41,6 +40,19 @@ var _ = Describe("Podman kill", func() {
Expect(session.ExitCode()).To(Not(Equal(0)))
})
+ It("podman container kill a running container by id", func() {
+ session := podmanTest.RunTopContainer("")
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ cid := session.OutputToString()
+
+ result := podmanTest.Podman([]string{"container", "kill", cid})
+ result.WaitWithDefaultTimeout()
+
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ })
+
It("podman kill a running container by id", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/libpod_suite_remoteclient_test.go b/test/e2e/libpod_suite_remoteclient_test.go
index e6bc00397..44c5edf07 100644
--- a/test/e2e/libpod_suite_remoteclient_test.go
+++ b/test/e2e/libpod_suite_remoteclient_test.go
@@ -18,6 +18,12 @@ func SkipIfRemote() {
ginkgo.Skip("This function is not enabled for remote podman")
}
+func SkipIfRootless() {
+ if os.Geteuid() != 0 {
+ ginkgo.Skip("This function is not enabled for remote podman")
+ }
+}
+
// Cleanup cleans up the temporary store
func (p *PodmanTestIntegration) Cleanup() {
p.StopVarlink()
@@ -133,6 +139,9 @@ func (p *PodmanTestIntegration) CleanupVolume() {
}
func PodmanTestCreate(tempDir string) *PodmanTestIntegration {
+ if os.Geteuid() != 0 {
+ ginkgo.Skip("This function is not enabled for rootless podman")
+ }
pti := PodmanTestCreateUtil(tempDir, true)
pti.StartVarlink()
return pti
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 33e05b872..685a08340 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -14,12 +14,23 @@ import (
"github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/inspect"
. "github.com/containers/libpod/test/utils"
+ "github.com/onsi/ginkgo"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)
-func SkipIfRemote() {}
+func SkipIfRemote() {
+ if os.Geteuid() != 0 {
+ ginkgo.Skip("This function is not enabled for rootless podman")
+ }
+}
+
+func SkipIfRootless() {
+ if os.Geteuid() != 0 {
+ ginkgo.Skip("This function is not enabled for rootless podman")
+ }
+}
// Podman is the exec call to podman on the filesystem
func (p *PodmanTestIntegration) Podman(args []string) *PodmanSessionIntegration {
@@ -206,8 +217,8 @@ 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.OCIRuntime, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager), " ")
+ podmanOptions := strings.Split(fmt.Sprintf("--root %s --runroot %s --runtime %s --conmon %s --cni-config-dir %s --cgroup-manager %s --tmpdir %s",
+ p.CrioRoot, p.RunRoot, p.OCIRuntime, p.ConmonBinary, p.CNIConfigDir, p.CgroupManager, p.TmpDir), " ")
if os.Getenv("HOOK_OPTION") != "" {
podmanOptions = append(podmanOptions, os.Getenv("HOOK_OPTION"))
}
diff --git a/test/e2e/load_test.go b/test/e2e/load_test.go
index 571754347..0e193640e 100644
--- a/test/e2e/load_test.go
+++ b/test/e2e/load_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
"path/filepath"
@@ -25,14 +24,15 @@ var _ = Describe("Podman load", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman load input flag", func() {
@@ -190,7 +190,7 @@ var _ = Describe("Podman load", func() {
load.WaitWithDefaultTimeout()
Expect(load.ExitCode()).To(Equal(0))
- result := podmanTest.Podman([]string{"images", "-f", "label", "hello:world"})
+ result := podmanTest.Podman([]string{"images", "hello:world"})
result.WaitWithDefaultTimeout()
Expect(result.LineInOutputContains("docker")).To(Not(BeTrue()))
Expect(result.LineInOutputContains("localhost")).To(BeTrue())
@@ -216,7 +216,7 @@ var _ = Describe("Podman load", func() {
load.WaitWithDefaultTimeout()
Expect(load.ExitCode()).To(Equal(0))
- result := podmanTest.Podman([]string{"images", "-f", "label", "hello:latest"})
+ result := podmanTest.Podman([]string{"images", "hello:latest"})
result.WaitWithDefaultTimeout()
Expect(result.LineInOutputContains("docker")).To(Not(BeTrue()))
Expect(result.LineInOutputContains("localhost")).To(BeTrue())
@@ -241,7 +241,7 @@ var _ = Describe("Podman load", func() {
load.WaitWithDefaultTimeout()
Expect(load.ExitCode()).To(Equal(0))
- result := podmanTest.Podman([]string{"images", "-f", "label", "load:latest"})
+ result := podmanTest.Podman([]string{"images", "load:latest"})
result.WaitWithDefaultTimeout()
Expect(result.LineInOutputContains("docker")).To(Not(BeTrue()))
Expect(result.LineInOutputContains("localhost")).To(BeTrue())
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index d3c4fb802..d051e3dba 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -3,8 +3,8 @@
package integration
import (
- "fmt"
"os"
+ "strings"
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
@@ -24,17 +24,17 @@ var _ = Describe("Podman logs", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
- //sudo bin/podman run -it --rm fedora-minimal bash -c 'for a in `seq 5`; do echo hello; done'
It("podman logs for container", func() {
logc := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
logc.WaitWithDefaultTimeout()
@@ -106,4 +106,40 @@ var _ = Describe("Podman logs", func() {
Expect(results.ExitCode()).To(Equal(0))
Expect(len(results.OutputToStringArray())).To(Equal(3))
})
+
+ It("podman logs latest and container name should fail", func() {
+ results := podmanTest.Podman([]string{"logs", "-l", "foobar"})
+ results.WaitWithDefaultTimeout()
+ Expect(results.ExitCode()).ToNot(Equal(0))
+ })
+
+ It("podman logs two containers and should display short container IDs", func() {
+ log1 := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ log1.WaitWithDefaultTimeout()
+ Expect(log1.ExitCode()).To(Equal(0))
+ cid1 := log1.OutputToString()
+
+ log2 := podmanTest.Podman([]string{"run", "-dt", ALPINE, "sh", "-c", "echo podman; echo podman; echo podman"})
+ log2.WaitWithDefaultTimeout()
+ Expect(log2.ExitCode()).To(Equal(0))
+ cid2 := log2.OutputToString()
+
+ results := podmanTest.Podman([]string{"logs", cid1, cid2})
+ results.WaitWithDefaultTimeout()
+ Expect(results.ExitCode()).To(Equal(0))
+
+ output := results.OutputToStringArray()
+ Expect(len(output)).To(Equal(6))
+ Expect(strings.Contains(output[0], cid1[:12]) || strings.Contains(output[0], cid2[:12])).To(BeTrue())
+ })
+
+ It("podman logs on a created container should result in 0 exit code", func() {
+ session := podmanTest.Podman([]string{"create", "-dt", "--name", "log", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+
+ results := podmanTest.Podman([]string{"logs", "log"})
+ results.WaitWithDefaultTimeout()
+ Expect(results.ExitCode()).To(BeZero())
+ })
})
diff --git a/test/e2e/mount_test.go b/test/e2e/mount_test.go
index 94218e6a9..b361e0057 100644
--- a/test/e2e/mount_test.go
+++ b/test/e2e/mount_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman mount", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman mount", func() {
@@ -49,6 +49,21 @@ var _ = Describe("Podman mount", func() {
Expect(umount.ExitCode()).To(Equal(0))
})
+ It("podman container mount", func() {
+ setup := podmanTest.Podman([]string{"container", "create", ALPINE, "ls"})
+ setup.WaitWithDefaultTimeout()
+ Expect(setup.ExitCode()).To(Equal(0))
+ cid := setup.OutputToString()
+
+ mount := podmanTest.Podman([]string{"container", "mount", cid})
+ mount.WaitWithDefaultTimeout()
+ Expect(mount.ExitCode()).To(Equal(0))
+
+ umount := podmanTest.Podman([]string{"container", "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()
diff --git a/test/e2e/namespace_test.go b/test/e2e/namespace_test.go
index a0b6e6187..28d050be3 100644
--- a/test/e2e/namespace_test.go
+++ b/test/e2e/namespace_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman namespaces", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman namespace test", func() {
diff --git a/test/e2e/pause_test.go b/test/e2e/pause_test.go
index f1ea17ead..e28c31c3a 100644
--- a/test/e2e/pause_test.go
+++ b/test/e2e/pause_test.go
@@ -22,19 +22,21 @@ var _ = Describe("Podman pause", func() {
createdState := "Created"
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman pause bogus container", func() {
@@ -80,6 +82,23 @@ var _ = Describe("Podman pause", func() {
result.WaitWithDefaultTimeout()
})
+ It("podman container pause a running container by id", func() {
+ session := podmanTest.RunTopContainer("")
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ cid := session.OutputToString()
+
+ result := podmanTest.Podman([]string{"container", "pause", cid})
+ result.WaitWithDefaultTimeout()
+
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
+ Expect(podmanTest.GetContainerStatus()).To(ContainSubstring(pausedState))
+
+ result = podmanTest.Podman([]string{"container", "unpause", cid})
+ result.WaitWithDefaultTimeout()
+ })
+
It("podman unpause a running container by id", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index 4717267a1..de0734e9f 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman pod create", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupPod()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman create pod", func() {
@@ -100,7 +100,7 @@ var _ = Describe("Podman pod create", func() {
It("podman create pod with network portbindings", func() {
name := "test"
- session := podmanTest.Podman([]string{"pod", "create", "--name", name, "-p", "80:80"})
+ session := podmanTest.Podman([]string{"pod", "create", "--name", name, "-p", "8080:80"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
pod := session.OutputToString()
@@ -109,7 +109,7 @@ var _ = Describe("Podman pod create", func() {
webserver.WaitWithDefaultTimeout()
Expect(webserver.ExitCode()).To(Equal(0))
- check := SystemExec("nc", []string{"-z", "localhost", "80"})
+ check := SystemExec("nc", []string{"-z", "localhost", "8080"})
Expect(check.ExitCode()).To(Equal(0))
})
diff --git a/test/e2e/pod_infra_container_test.go b/test/e2e/pod_infra_container_test.go
index ed5002ca7..82f35999c 100644
--- a/test/e2e/pod_infra_container_test.go
+++ b/test/e2e/pod_infra_container_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
"strconv"
@@ -25,6 +24,7 @@ var _ = Describe("Podman pod create", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
podmanTest.RestoreArtifact(infra)
})
@@ -32,8 +32,8 @@ var _ = Describe("Podman pod create", func() {
AfterEach(func() {
podmanTest.CleanupPod()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman create infra container", func() {
@@ -69,6 +69,18 @@ var _ = Describe("Podman pod create", func() {
Expect(len(check.OutputToStringArray())).To(Equal(1))
})
+ It("podman start infra container different image", func() {
+ session := podmanTest.Podman([]string{"pod", "create", "--infra-image", BB})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ podID := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"pod", "start", podID})
+ session.WaitWithDefaultTimeout()
+ // If we use the default entry point, we should exit with no error
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
It("podman infra container namespaces", func() {
session := podmanTest.Podman([]string{"pod", "create"})
session.WaitWithDefaultTimeout()
@@ -209,8 +221,7 @@ var _ = Describe("Podman pod create", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- podmanTest.RestoreArtifact(fedoraMinimal)
- session = podmanTest.Podman([]string{"run", "--pod", podID, "--network", "bridge", fedoraMinimal, "curl", "localhost"})
+ session = podmanTest.Podman([]string{"run", "--pod", podID, "--network", "bridge", nginx, "curl", "localhost"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Not(Equal(0)))
})
@@ -360,4 +371,21 @@ var _ = Describe("Podman pod create", func() {
Expect(result.OutputToString()).To(ContainSubstring(infraID))
})
+
+ It("podman run --add-host in pod", func() {
+ session := podmanTest.Podman([]string{"pod", "create"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ podID := session.OutputToString()
+
+ // verify we can add a host to the infra's /etc/hosts
+ session = podmanTest.Podman([]string{"run", "--pod", podID, "--add-host", "foobar:127.0.0.1", BB, "ping", "-c", "1", "foobar"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ // verify we can see the other hosts of infra's /etc/hosts
+ session = podmanTest.Podman([]string{"run", "--pod", podID, BB, "ping", "-c", "1", "foobar"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
})
diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go
index 457acb373..671d203a6 100644
--- a/test/e2e/pod_inspect_test.go
+++ b/test/e2e/pod_inspect_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman pod inspect", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupPod()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman inspect bogus pod", func() {
diff --git a/test/e2e/pod_kill_test.go b/test/e2e/pod_kill_test.go
index 419a3a777..c1f7503e3 100644
--- a/test/e2e/pod_kill_test.go
+++ b/test/e2e/pod_kill_test.go
@@ -24,14 +24,15 @@ var _ = Describe("Podman pod kill", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupPod()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman pod kill bogus", func() {
diff --git a/test/e2e/pod_pause_test.go b/test/e2e/pod_pause_test.go
index a5192f84b..59a4da176 100644
--- a/test/e2e/pod_pause_test.go
+++ b/test/e2e/pod_pause_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -21,19 +20,21 @@ var _ = Describe("Podman pod pause", func() {
pausedState := "Paused"
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupPod()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman pod pause bogus pod", func() {
diff --git a/test/e2e/pod_pod_namespaces.go b/test/e2e/pod_pod_namespaces.go
index 9815e37ef..9d6321c0e 100644
--- a/test/e2e/pod_pod_namespaces.go
+++ b/test/e2e/pod_pod_namespaces.go
@@ -24,6 +24,7 @@ var _ = Describe("Podman pod create", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
podmanTest.RestoreArtifact(infra)
})
@@ -31,8 +32,8 @@ var _ = Describe("Podman pod create", func() {
AfterEach(func() {
podmanTest.CleanupPod()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman pod container share Namespaces", func() {
diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go
index 3b7198861..2fa26d7ad 100644
--- a/test/e2e/pod_ps_test.go
+++ b/test/e2e/pod_ps_test.go
@@ -25,14 +25,15 @@ var _ = Describe("Podman ps", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupPod()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman pod ps no pods", func() {
diff --git a/test/e2e/pod_restart_test.go b/test/e2e/pod_restart_test.go
index e8acfd2ec..ffb6cb94c 100644
--- a/test/e2e/pod_restart_test.go
+++ b/test/e2e/pod_restart_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman pod restart", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupPod()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman pod restart bogus pod", func() {
diff --git a/test/e2e/pod_rm_test.go b/test/e2e/pod_rm_test.go
index f63d2c8aa..f9d7abe8f 100644
--- a/test/e2e/pod_rm_test.go
+++ b/test/e2e/pod_rm_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman pod rm", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupPod()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman pod rm empty pod", func() {
diff --git a/test/e2e/pod_start_test.go b/test/e2e/pod_start_test.go
index ce693012d..de52af2a0 100644
--- a/test/e2e/pod_start_test.go
+++ b/test/e2e/pod_start_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman pod start", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupPod()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman pod start bogus pod", func() {
diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go
index e330c3a39..6018b4494 100644
--- a/test/e2e/pod_stats_test.go
+++ b/test/e2e/pod_stats_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -19,19 +18,21 @@ var _ = Describe("Podman pod stats", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupPod()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman stats should run with no pods", func() {
session := podmanTest.Podman([]string{"pod", "stats", "--no-stream"})
diff --git a/test/e2e/pod_stop_test.go b/test/e2e/pod_stop_test.go
index 38f118964..fa285fa80 100644
--- a/test/e2e/pod_stop_test.go
+++ b/test/e2e/pod_stop_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman pod stop", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupPod()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman pod stop bogus pod", func() {
diff --git a/test/e2e/pod_top_test.go b/test/e2e/pod_top_test.go
index 507d723b4..964ee075f 100644
--- a/test/e2e/pod_top_test.go
+++ b/test/e2e/pod_top_test.go
@@ -5,6 +5,7 @@ package integration
import (
"fmt"
"os"
+ "time"
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
@@ -24,14 +25,15 @@ var _ = Describe("Podman top", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupPod()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman pod top without pod name or id", func() {
@@ -127,6 +129,13 @@ var _ = Describe("Podman top", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
+ for i := 0; i < 10; i++ {
+ fmt.Println("Waiting for containers to be running .... ")
+ if podmanTest.NumberOfContainersRunning() == 2 {
+ break
+ }
+ time.Sleep(1 * time.Second)
+ }
result := podmanTest.Podman([]string{"pod", "top", podid})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
diff --git a/test/e2e/port_test.go b/test/e2e/port_test.go
index fa633c379..7cf3e16bf 100644
--- a/test/e2e/port_test.go
+++ b/test/e2e/port_test.go
@@ -25,14 +25,15 @@ var _ = Describe("Podman port", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman port all and latest", func() {
@@ -60,6 +61,19 @@ var _ = Describe("Podman port", func() {
Expect(result.LineInOuputStartsWith(fmt.Sprintf("80/tcp -> 0.0.0.0:%s", port))).To(BeTrue())
})
+ It("podman container port -l nginx", func() {
+ podmanTest.RestoreArtifact(nginx)
+ session := podmanTest.Podman([]string{"container", "run", "-dt", "-P", nginx})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"container", "port", "-l"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ port := strings.Split(result.OutputToStringArray()[0], ":")[1]
+ 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", nginx})
diff --git a/test/e2e/prune_test.go b/test/e2e/prune_test.go
index 74cdc126f..869ca3289 100644
--- a/test/e2e/prune_test.go
+++ b/test/e2e/prune_test.go
@@ -1,7 +1,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -28,14 +27,15 @@ var _ = Describe("Podman rm", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman container prune containers", func() {
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index 9b1c55bb4..957c69aa8 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -28,14 +28,15 @@ var _ = Describe("Podman ps", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman ps no containers", func() {
@@ -65,7 +66,24 @@ var _ = Describe("Podman ps", func() {
Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
})
+ It("podman container list all", func() {
+ _, ec, _ := podmanTest.RunLsContainer("")
+ Expect(ec).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"container", "list", "-a"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
+
+ result = podmanTest.Podman([]string{"container", "ls", "-a"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(len(result.OutputToStringArray())).Should(BeNumerically(">", 0))
+ })
+
It("podman ps size flag", func() {
+ SkipIfRootless()
+
_, ec, _ := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
@@ -217,6 +235,8 @@ var _ = Describe("Podman ps", func() {
})
It("podman --sort by size", func() {
+ SkipIfRootless()
+
session := podmanTest.Podman([]string{"create", "busybox", "ls"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -256,8 +276,7 @@ var _ = Describe("Podman ps", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- podmanTest.RestoreArtifact(fedoraMinimal)
- session = podmanTest.Podman([]string{"run", "-d", fedoraMinimal, "pwd"})
+ session = podmanTest.Podman([]string{"run", "-d", ALPINE, "pwd"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -288,4 +307,19 @@ var _ = Describe("Podman ps", func() {
Expect(session.OutputToString()).To(ContainSubstring(podid))
})
+
+ It("podman ps test with port range", func() {
+ SkipIfRootless()
+ session := podmanTest.RunTopContainer("")
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"run", "-dt", "-p", "1000-1006:1000-1006", ALPINE, "top"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"ps", "--format", "{{.Ports}}"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.OutputToString()).To(ContainSubstring("0.0.0.0:1000-1006"))
+ })
})
diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go
index d9b9c7213..de6d4ea09 100644
--- a/test/e2e/pull_test.go
+++ b/test/e2e/pull_test.go
@@ -27,14 +27,15 @@ var _ = Describe("Podman pull", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman pull from docker with tag", func() {
diff --git a/test/e2e/push_test.go b/test/e2e/push_test.go
index fee117783..009067482 100644
--- a/test/e2e/push_test.go
+++ b/test/e2e/push_test.go
@@ -26,14 +26,15 @@ var _ = Describe("Podman push", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman push to containers/storage", func() {
@@ -62,6 +63,8 @@ var _ = Describe("Podman push", func() {
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
+ lock := GetPortLock("5000")
+ defer lock.Unlock()
podmanTest.RestoreArtifact(registry)
session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"})
session.WaitWithDefaultTimeout()
@@ -77,6 +80,7 @@ var _ = Describe("Podman push", func() {
})
It("podman push to local registry with authorization", func() {
+ SkipIfRootless()
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
@@ -100,6 +104,8 @@ var _ = Describe("Podman push", func() {
}()
}
}
+ lock := GetPortLock("5000")
+ defer lock.Unlock()
podmanTest.RestoreArtifact(registry)
session := podmanTest.Podman([]string{"run", "--entrypoint", "htpasswd", registry, "-Bbn", "podmantest", "test"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/refresh_test.go b/test/e2e/refresh_test.go
index de331bf88..56c1d255e 100644
--- a/test/e2e/refresh_test.go
+++ b/test/e2e/refresh_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
"time"
@@ -25,14 +24,15 @@ var _ = Describe("Podman refresh", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tmpdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
Specify("Refresh with no containers succeeds", func() {
diff --git a/test/e2e/restart_test.go b/test/e2e/restart_test.go
index 5c914a367..1daf63a0e 100644
--- a/test/e2e/restart_test.go
+++ b/test/e2e/restart_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
"time"
@@ -25,14 +24,15 @@ var _ = Describe("Podman restart", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("Podman restart bogus container", func() {
@@ -90,6 +90,21 @@ var _ = Describe("Podman restart", func() {
Expect(restartTime.OutputToString()).To(Not(Equal(startTime.OutputToString())))
})
+ It("Podman container restart running container", func() {
+ _ = podmanTest.RunTopContainer("test1")
+ ok := WaitForContainer(podmanTest)
+ Expect(ok).To(BeTrue())
+ startTime := podmanTest.Podman([]string{"container", "inspect", "--format='{{.State.StartedAt}}'", "test1"})
+ startTime.WaitWithDefaultTimeout()
+
+ session := podmanTest.Podman([]string{"container", "restart", "test1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ restartTime := podmanTest.Podman([]string{"container", "inspect", "--format='{{.State.StartedAt}}'", "test1"})
+ restartTime.WaitWithDefaultTimeout()
+ Expect(restartTime.OutputToString()).To(Not(Equal(startTime.OutputToString())))
+ })
+
It("Podman restart multiple containers", func() {
_, exitCode, _ := podmanTest.RunLsContainer("test1")
Expect(exitCode).To(Equal(0))
diff --git a/test/e2e/rm_test.go b/test/e2e/rm_test.go
index 71dacfa80..9bf742a63 100644
--- a/test/e2e/rm_test.go
+++ b/test/e2e/rm_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman rm", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman rm stopped container", func() {
@@ -65,6 +65,17 @@ var _ = Describe("Podman rm", func() {
Expect(result.ExitCode()).To(Equal(0))
})
+ It("podman container rm created container", func() {
+ session := podmanTest.Podman([]string{"container", "create", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ cid := session.OutputToString()
+
+ result := podmanTest.Podman([]string{"container", "rm", cid})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ })
+
It("podman rm running container with -f", func() {
session := podmanTest.RunTopContainer("")
session.WaitWithDefaultTimeout()
@@ -128,9 +139,23 @@ var _ = Describe("Podman rm", func() {
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
})
+
It("podman rm bogus container", func() {
session := podmanTest.Podman([]string{"rm", "bogus"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(1))
})
+ It("podman rm bogus container and a running container", func() {
+ session := podmanTest.RunTopContainer("test1")
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"rm", "bogus", "test1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+
+ session = podmanTest.Podman([]string{"rm", "test1", "bogus"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ })
})
diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go
index dcbda2df4..78d175637 100644
--- a/test/e2e/rmi_test.go
+++ b/test/e2e/rmi_test.go
@@ -22,14 +22,14 @@ var _ = Describe("Podman rmi", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
})
@@ -275,4 +275,13 @@ RUN find $LOCAL
Expect(images.ExitCode()).To(Equal(0))
Expect(len(images.OutputToStringArray())).To(Equal(0))
})
+
+ // Don't rerun all tests; just assume that if we get that diagnostic,
+ // we're getting rmi
+ It("podman image rm is the same as rmi", func() {
+ session := podmanTest.Podman([]string{"image", "rm"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(125))
+ Expect(session.LineInOutputContains("image name or ID must be specified"))
+ })
})
diff --git a/test/e2e/rootless_test.go b/test/e2e/rootless_test.go
index aa8ed6faa..51544ff8b 100644
--- a/test/e2e/rootless_test.go
+++ b/test/e2e/rootless_test.go
@@ -38,6 +38,7 @@ var _ = Describe("Podman rootless", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
@@ -45,14 +46,15 @@ var _ = Describe("Podman rootless", func() {
podmanTest = PodmanTestCreate(tempdir)
podmanTest.CgroupManager = "cgroupfs"
podmanTest.StorageOptions = ROOTLESS_STORAGE_OPTIONS
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman rootless help|version", func() {
@@ -125,7 +127,6 @@ var _ = Describe("Podman rootless", func() {
env := os.Environ()
env = append(env, fmt.Sprintf("XDG_RUNTIME_DIR=%s", xdgRuntimeDir))
env = append(env, fmt.Sprintf("HOME=%s", home))
- env = append(env, "PODMAN_ALLOW_SINGLE_ID_MAPPING_IN_USERNS=1")
env = append(env, "USER=foo")
cmd := rootlessTest.PodmanAsUser([]string{"pod", "create", "--infra=false"}, 1000, 1000, "", env)
@@ -138,6 +139,21 @@ var _ = Describe("Podman rootless", func() {
cmd.WaitWithDefaultTimeout()
Expect(cmd.ExitCode()).To(Equal(0))
Expect(cmd.LineInOutputContains("hello")).To(BeTrue())
+
+ args = []string{"pod", "top", podId}
+ cmd = rootlessTest.PodmanAsUser(args, 1000, 1000, "", env)
+ cmd.WaitWithDefaultTimeout()
+ Expect(cmd.ExitCode()).To(Not(Equal(0)))
+
+ args = []string{"run", "--pod", podId, "-d", "--rootfs", mountPath, "sleep", "100"}
+ cmd = rootlessTest.PodmanAsUser(args, 1000, 1000, "", env)
+ cmd.WaitWithDefaultTimeout()
+ Expect(cmd.ExitCode()).To(Equal(0))
+
+ args = []string{"pod", "top", podId}
+ cmd = rootlessTest.PodmanAsUser(args, 1000, 1000, "", env)
+ cmd.WaitWithDefaultTimeout()
+ Expect(cmd.ExitCode()).To(Equal(0))
}
runInRootlessContext(f)
})
@@ -170,7 +186,6 @@ var _ = Describe("Podman rootless", func() {
env := os.Environ()
env = append(env, fmt.Sprintf("XDG_RUNTIME_DIR=%s", xdgRuntimeDir))
env = append(env, fmt.Sprintf("HOME=%s", home))
- env = append(env, "PODMAN_ALLOW_SINGLE_ID_MAPPING_IN_USERNS=1")
env = append(env, "USER=foo")
allArgs := append([]string{"run"}, args...)
diff --git a/test/e2e/run_cgroup_parent_test.go b/test/e2e/run_cgroup_parent_test.go
index efc9a7009..0d04c5f03 100644
--- a/test/e2e/run_cgroup_parent_test.go
+++ b/test/e2e/run_cgroup_parent_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -19,19 +18,21 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreArtifact(fedoraMinimal)
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
Specify("valid --cgroup-parent using cgroupfs", func() {
diff --git a/test/e2e/run_cleanup_test.go b/test/e2e/run_cleanup_test.go
index 1f2a4085d..b20e37794 100644
--- a/test/e2e/run_cleanup_test.go
+++ b/test/e2e/run_cleanup_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman run exit", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman run -d mount cleanup test", func() {
diff --git a/test/e2e/run_cpu_test.go b/test/e2e/run_cpu_test.go
index f74d3ed84..42a66865c 100644
--- a/test/e2e/run_cpu_test.go
+++ b/test/e2e/run_cpu_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,17 +23,19 @@ var _ = Describe("Podman run cpu", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman run cpu-period", func() {
+ SkipIfRootless()
result := podmanTest.Podman([]string{"run", "--rm", "--cpu-period=5000", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_period_us"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
@@ -42,6 +43,7 @@ var _ = Describe("Podman run cpu", func() {
})
It("podman run cpu-quota", func() {
+ SkipIfRootless()
result := podmanTest.Podman([]string{"run", "--rm", "--cpu-quota=5000", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
@@ -49,6 +51,7 @@ var _ = Describe("Podman run cpu", func() {
})
It("podman run cpus", func() {
+ SkipIfRootless()
result := podmanTest.Podman([]string{"run", "--rm", "--cpus=0.5", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_period_us"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
@@ -61,6 +64,7 @@ var _ = Describe("Podman run cpu", func() {
})
It("podman run cpu-shares", func() {
+ SkipIfRootless()
result := podmanTest.Podman([]string{"run", "--rm", "--cpu-shares=2", ALPINE, "cat", "/sys/fs/cgroup/cpu/cpu.shares"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
@@ -68,6 +72,7 @@ var _ = Describe("Podman run cpu", func() {
})
It("podman run cpuset-cpus", func() {
+ SkipIfRootless()
result := podmanTest.Podman([]string{"run", "--rm", "--cpuset-cpus=0", ALPINE, "cat", "/sys/fs/cgroup/cpuset/cpuset.cpus"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
@@ -75,6 +80,7 @@ var _ = Describe("Podman run cpu", func() {
})
It("podman run cpuset-mems", func() {
+ SkipIfRootless()
result := podmanTest.Podman([]string{"run", "--rm", "--cpuset-mems=0", ALPINE, "cat", "/sys/fs/cgroup/cpuset/cpuset.mems"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(0))
diff --git a/test/e2e/run_device_test.go b/test/e2e/run_device_test.go
index 4f26ac8ee..fac09b78d 100644
--- a/test/e2e/run_device_test.go
+++ b/test/e2e/run_device_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman run device", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman run bad device test", func() {
@@ -41,6 +41,7 @@ var _ = Describe("Podman run device", func() {
})
It("podman run device test", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "-q", "--device", "/dev/kmsg", ALPINE, "ls", "--color=never", "/dev/kmsg"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -48,6 +49,7 @@ var _ = Describe("Podman run device", func() {
})
It("podman run device rename test", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "-q", "--device", "/dev/kmsg:/dev/kmsg1", ALPINE, "ls", "--color=never", "/dev/kmsg1"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -55,6 +57,7 @@ var _ = Describe("Podman run device", func() {
})
It("podman run device permission test", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "-q", "--device", "/dev/kmsg:r", ALPINE, "ls", "--color=never", "/dev/kmsg"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -62,6 +65,7 @@ var _ = Describe("Podman run device", func() {
})
It("podman run device rename and permission test", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "-q", "--device", "/dev/kmsg:/dev/kmsg1:r", ALPINE, "ls", "--color=never", "/dev/kmsg1"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -72,4 +76,13 @@ var _ = Describe("Podman run device", func() {
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Not(Equal(0)))
})
+
+ It("podman run device host device and container device parameter are directories", func() {
+ SkipIfRootless()
+ SystemExec("mkdir", []string{"/dev/foodevdir"})
+ SystemExec("mknod", []string{"/dev/foodevdir/null", "c", "1", "3"})
+ session := podmanTest.Podman([]string{"run", "-q", "--device", "/dev/foodevdir:/dev/bar", ALPINE, "ls", "/dev/bar/null"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
})
diff --git a/test/e2e/run_dns_test.go b/test/e2e/run_dns_test.go
index 6c649cdbc..0f4dd6742 100644
--- a/test/e2e/run_dns_test.go
+++ b/test/e2e/run_dns_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman run dns", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman run add search domain", func() {
@@ -88,6 +88,7 @@ var _ = Describe("Podman run dns", func() {
})
It("podman run add hostname sets /etc/hosts", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "-t", "-i", "--hostname=foobar", ALPINE, "cat", "/etc/hosts"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/run_entrypoint_test.go b/test/e2e/run_entrypoint_test.go
index a33e16b63..ee9fd1263 100644
--- a/test/e2e/run_entrypoint_test.go
+++ b/test/e2e/run_entrypoint_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman run entrypoint", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreArtifact(ALPINE)
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman run no command, entrypoint, or cmd", func() {
diff --git a/test/e2e/run_exit_test.go b/test/e2e/run_exit_test.go
index 03072f598..da4cf7ee7 100644
--- a/test/e2e/run_exit_test.go
+++ b/test/e2e/run_exit_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman run exit", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman run exit 125", func() {
@@ -59,8 +59,7 @@ var _ = Describe("Podman run exit", func() {
})
It("podman run exit 50", func() {
- podmanTest.RestoreArtifact(fedoraMinimal)
- result := podmanTest.Podman([]string{"run", "registry.fedoraproject.org/fedora-minimal", "bash", "-c", "exit 50"})
+ result := podmanTest.Podman([]string{"run", ALPINE, "sh", "-c", "exit 50"})
result.WaitWithDefaultTimeout()
Expect(result.ExitCode()).To(Equal(50))
})
diff --git a/test/e2e/run_memory_test.go b/test/e2e/run_memory_test.go
index e9262d4f0..05d0b7a18 100644
--- a/test/e2e/run_memory_test.go
+++ b/test/e2e/run_memory_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -19,19 +18,21 @@ var _ = Describe("Podman run memory", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman run memory test", func() {
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index c89a4f487..93919925c 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -25,14 +24,15 @@ var _ = Describe("Podman run networking", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman run network connection with default bridge", func() {
@@ -54,6 +54,7 @@ var _ = Describe("Podman run networking", func() {
})
It("podman run network expose port 222", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "-dt", "--expose", "222-223", "-P", ALPINE, "/bin/sh"})
session.Wait(30)
Expect(session.ExitCode()).To(Equal(0))
@@ -64,6 +65,7 @@ var _ = Describe("Podman run networking", func() {
})
It("podman run network expose host port 80 to container port 8000", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "-dt", "-p", "80:8000", ALPINE, "/bin/sh"})
session.Wait(30)
Expect(session.ExitCode()).To(Equal(0))
@@ -146,6 +148,7 @@ var _ = Describe("Podman run networking", func() {
})
It("podman run --net container: copies hosts and resolv", func() {
+ SkipIfRootless()
ctrName := "ctr1"
ctr1 := podmanTest.RunTopContainer(ctrName)
ctr1.WaitWithDefaultTimeout()
@@ -177,6 +180,7 @@ var _ = Describe("Podman run networking", func() {
})
It("podman run network in user created network namespace", func() {
+ SkipIfRootless()
if Containerized() {
Skip("Can not be run within a container.")
}
@@ -193,6 +197,7 @@ var _ = Describe("Podman run networking", func() {
})
It("podman run n user created network namespace with resolv.conf", func() {
+ SkipIfRootless()
if Containerized() {
Skip("Can not be run within a container.")
}
diff --git a/test/e2e/run_ns_test.go b/test/e2e/run_ns_test.go
index 3d95c3a0b..5236e6584 100644
--- a/test/e2e/run_ns_test.go
+++ b/test/e2e/run_ns_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
"strings"
@@ -25,14 +24,15 @@ var _ = Describe("Podman run ns", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreArtifact(fedoraMinimal)
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman run pidns test", func() {
@@ -63,6 +63,7 @@ var _ = Describe("Podman run ns", func() {
})
It("podman run ipcns ipcmk host test", func() {
+ SkipIfRootless()
setup := SystemExec("ipcmk", []string{"-M", "1024"})
Expect(setup.ExitCode()).To(Equal(0))
output := strings.Split(setup.OutputToString(), " ")
@@ -76,6 +77,7 @@ var _ = Describe("Podman run ns", func() {
})
It("podman run ipcns ipcmk container test", func() {
+ SkipIfRootless()
setup := podmanTest.Podman([]string{"run", "-d", "--name", "test1", fedoraMinimal, "sleep", "999"})
setup.WaitWithDefaultTimeout()
Expect(setup.ExitCode()).To(Equal(0))
diff --git a/test/e2e/run_passwd_test.go b/test/e2e/run_passwd_test.go
index fcb81fb77..becbc5bfa 100644
--- a/test/e2e/run_passwd_test.go
+++ b/test/e2e/run_passwd_test.go
@@ -5,7 +5,6 @@ package integration
import (
"os"
- "fmt"
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -24,14 +23,15 @@ var _ = Describe("Podman run passwd", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman run no user specified ", func() {
diff --git a/test/e2e/run_privileged_test.go b/test/e2e/run_privileged_test.go
index ee6e8e950..16011b2fd 100644
--- a/test/e2e/run_privileged_test.go
+++ b/test/e2e/run_privileged_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
"strings"
@@ -25,14 +24,15 @@ var _ = Describe("Podman privileged container tests", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman privileged make sure sys is mounted rw", func() {
@@ -45,6 +45,7 @@ var _ = Describe("Podman privileged container tests", func() {
})
It("podman privileged CapEff", func() {
+ SkipIfRootless()
cap := SystemExec("grep", []string{"CapEff", "/proc/self/status"})
Expect(cap.ExitCode()).To(Equal(0))
@@ -55,6 +56,7 @@ var _ = Describe("Podman privileged container tests", func() {
})
It("podman cap-add CapEff", func() {
+ SkipIfRootless()
cap := SystemExec("grep", []string{"CapEff", "/proc/self/status"})
Expect(cap.ExitCode()).To(Equal(0))
@@ -80,6 +82,7 @@ var _ = Describe("Podman privileged container tests", func() {
})
It("podman privileged should inherit host devices", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "ls", "-l", "/dev"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/run_restart_test.go b/test/e2e/run_restart_test.go
index 2659d2b11..9976b45e8 100644
--- a/test/e2e/run_restart_test.go
+++ b/test/e2e/run_restart_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman run restart containers", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("Podman start after successful run", func() {
diff --git a/test/e2e/run_selinux_test.go b/test/e2e/run_selinux_test.go
index 57e488abc..4d2bad49c 100644
--- a/test/e2e/run_selinux_test.go
+++ b/test/e2e/run_selinux_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -25,6 +24,7 @@ var _ = Describe("Podman run", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
if !selinux.GetEnabled() {
Skip("SELinux not enabled")
@@ -34,8 +34,8 @@ var _ = Describe("Podman run", func() {
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman run selinux", func() {
@@ -112,6 +112,7 @@ var _ = Describe("Podman run", func() {
})
It("podman test selinux label /run/secrets", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", fedoraMinimal, "ls", "-dZ", "/run/secrets"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -144,6 +145,7 @@ var _ = Describe("Podman run", func() {
})
It("podman test selinux --privileged label /run/secrets", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--privileged", fedoraMinimal, "ls", "-dZ", "/run/secrets"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
diff --git a/test/e2e/run_signal_test.go b/test/e2e/run_signal_test.go
index 51c14602e..e482adb84 100644
--- a/test/e2e/run_signal_test.go
+++ b/test/e2e/run_signal_test.go
@@ -32,14 +32,15 @@ var _ = Describe("Podman run with --sig-proxy", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tmpdir)
+ podmanTest.Setup()
podmanTest.RestoreArtifact(fedoraMinimal)
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
Specify("signals are forwarded to container using sig-proxy", func() {
diff --git a/test/e2e/run_staticip_test.go b/test/e2e/run_staticip_test.go
index bf50e5eb7..318a7a62d 100644
--- a/test/e2e/run_staticip_test.go
+++ b/test/e2e/run_staticip_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -19,11 +18,13 @@ var _ = Describe("Podman run with --ip flag", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
// Cleanup the CNI networks used by the tests
os.RemoveAll("/var/lib/cni/networks/podman")
@@ -32,8 +33,8 @@ var _ = Describe("Podman run with --ip flag", func() {
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("Podman run --ip with garbage address", func() {
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index 93ee5036f..b0dc66707 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -29,14 +29,15 @@ var _ = Describe("Podman run", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman run a container based on local image", func() {
@@ -46,6 +47,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run a container based on a complex local image name", func() {
+ SkipIfRootless()
imageName := strings.TrimPrefix(nginx, "quay.io/")
podmanTest.RestoreArtifact(nginx)
session := podmanTest.Podman([]string{"run", imageName, "ls"})
@@ -68,6 +70,20 @@ var _ = Describe("Podman run", func() {
Expect(session.ExitCode()).To(Equal(0))
})
+ It("podman container run a container based on on a short name with localhost", func() {
+ podmanTest.RestoreArtifact(nginx)
+ tag := podmanTest.Podman([]string{"image", "tag", nginx, "localhost/libpod/alpine_nginx:latest"})
+ tag.WaitWithDefaultTimeout()
+
+ rmi := podmanTest.Podman([]string{"image", "rm", nginx})
+ rmi.WaitWithDefaultTimeout()
+
+ session := podmanTest.Podman([]string{"container", "run", "libpod/alpine_nginx:latest", "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ErrorToString()).ToNot(ContainSubstring("Trying to pull"))
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
It("podman run a container based on local image with short options", func() {
session := podmanTest.Podman([]string{"run", "-dt", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
@@ -136,10 +152,10 @@ var _ = Describe("Podman run", func() {
})
It("podman run environment test", func() {
- session := podmanTest.Podman([]string{"run", "--rm", "--env", "FOO=BAR", ALPINE, "printenv", "FOO"})
+ session := podmanTest.Podman([]string{"run", "--rm", "--env", "FOO=BAR,BAZ", ALPINE, "printenv", "FOO"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
- match, _ := session.GrepString("BAR")
+ match, _ := session.GrepString("BAR,BAZ")
Expect(match).Should(BeTrue())
session = podmanTest.Podman([]string{"run", "--rm", "--env", "PATH=/bin", ALPINE, "printenv", "PATH"})
@@ -170,6 +186,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run limits test", func() {
+ SkipIfRootless()
podmanTest.RestoreArtifact(fedoraMinimal)
session := podmanTest.Podman([]string{"run", "--rm", "--ulimit", "rtprio=99", "--cap-add=sys_nice", fedoraMinimal, "cat", "/proc/self/sched"})
session.WaitWithDefaultTimeout()
@@ -196,6 +213,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run with volume flag", func() {
+ SkipIfRootless()
Skip("Skip until we diagnose the regression of volume mounts")
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
os.Mkdir(mountPath, 0755)
@@ -260,6 +278,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run sysctl test", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--rm", "--sysctl", "net.core.somaxconn=65535", ALPINE, "sysctl", "net.core.somaxconn"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -267,6 +286,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run blkio-weight test", func() {
+ SkipIfRootless()
if _, err := os.Stat("/sys/fs/cgroup/blkio/blkio.weight"); os.IsNotExist(err) {
Skip("Kernel does not support blkio.weight")
}
@@ -277,6 +297,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run device-read-bps test", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--rm", "--device-read-bps=/dev/zero:1mb", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.throttle.read_bps_device"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -284,6 +305,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run device-write-bps test", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--rm", "--device-write-bps=/dev/zero:1mb", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.throttle.write_bps_device"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -291,6 +313,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run device-read-iops test", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--rm", "--device-read-iops=/dev/zero:100", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.throttle.read_iops_device"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -298,6 +321,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run device-write-iops test", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--rm", "--device-write-iops=/dev/zero:100", ALPINE, "cat", "/sys/fs/cgroup/blkio/blkio.throttle.write_iops_device"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -401,6 +425,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run with FIPS mode secrets", func() {
+ SkipIfRootless()
fipsFile := "/etc/system-fips"
err = ioutil.WriteFile(fipsFile, []byte{}, 0755)
Expect(err).To(BeNil())
@@ -415,6 +440,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run without group-add", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "id"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -422,6 +448,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run with group-add", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--rm", "--group-add=audio", "--group-add=nogroup", "--group-add=777", ALPINE, "id"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -429,6 +456,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run with user (default)", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "id"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -443,6 +471,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run with user (integer, in /etc/passwd)", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--rm", "--user=8", ALPINE, "id"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -450,6 +479,7 @@ var _ = Describe("Podman run", func() {
})
It("podman run with user (username)", func() {
+ SkipIfRootless()
session := podmanTest.Podman([]string{"run", "--rm", "--user=mail", ALPINE, "id"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -704,4 +734,28 @@ USER mail`
Expect(session.OutputToString()).To(Not(ContainSubstring("/dev/shm type tmpfs (ro,")))
})
+
+ It("podman run with bad healthcheck interval", func() {
+ session := podmanTest.Podman([]string{"run", "-dt", "--healthcheck-cmd", "foo", "--healthcheck-interval", "0.5s", ALPINE, "top"})
+ session.Wait()
+ Expect(session.ExitCode()).ToNot(Equal(0))
+ })
+
+ It("podman run with bad healthcheck retries", func() {
+ session := podmanTest.Podman([]string{"run", "-dt", "--healthcheck-cmd", "foo", "--healthcheck-retries", "0", ALPINE, "top"})
+ session.Wait()
+ Expect(session.ExitCode()).ToNot(Equal(0))
+ })
+
+ It("podman run with bad healthcheck timeout", func() {
+ session := podmanTest.Podman([]string{"run", "-dt", "--healthcheck-cmd", "foo", "--healthcheck-timeout", "0s", ALPINE, "top"})
+ session.Wait()
+ Expect(session.ExitCode()).ToNot(Equal(0))
+ })
+
+ It("podman run with bad healthcheck start-period", func() {
+ session := podmanTest.Podman([]string{"run", "-dt", "--healthcheck-cmd", "foo", "--healthcheck-start-period", "-1s", ALPINE, "top"})
+ session.Wait()
+ Expect(session.ExitCode()).ToNot(Equal(0))
+ })
})
diff --git a/test/e2e/run_userns_test.go b/test/e2e/run_userns_test.go
index 254897e70..5c38a8950 100644
--- a/test/e2e/run_userns_test.go
+++ b/test/e2e/run_userns_test.go
@@ -5,7 +5,6 @@ package integration
import (
"os"
- "fmt"
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -19,19 +18,21 @@ var _ = Describe("Podman UserNS support", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman uidmapping and gidmapping", func() {
@@ -68,6 +69,21 @@ var _ = Describe("Podman UserNS support", func() {
Expect(ok).To(BeTrue())
})
+ It("podman uidmapping and gidmapping with a volume", func() {
+ if os.Getenv("SKIP_USERNS") != "" {
+ Skip("Skip userns tests.")
+ }
+ if _, err := os.Stat("/proc/self/uid_map"); err != nil {
+ Skip("User namespaces not supported.")
+ }
+
+ session := podmanTest.Podman([]string{"run", "--uidmap=0:1:70000", "--gidmap=0:20000:70000", "-v", "my-foo-volume:/foo:Z", "busybox", "echo", "hello"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ ok, _ := session.GrepString("hello")
+ Expect(ok).To(BeTrue())
+ })
+
It("podman uidmapping and gidmapping --net=host", func() {
if os.Getenv("SKIP_USERNS") != "" {
Skip("Skip userns tests.")
diff --git a/test/e2e/runlabel_test.go b/test/e2e/runlabel_test.go
index 49b9e13d8..b1d057bfd 100644
--- a/test/e2e/runlabel_test.go
+++ b/test/e2e/runlabel_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -32,14 +31,14 @@ var _ = Describe("podman container runlabel", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
})
diff --git a/test/e2e/save_test.go b/test/e2e/save_test.go
index 9f64e49a7..c3edc7c7e 100644
--- a/test/e2e/save_test.go
+++ b/test/e2e/save_test.go
@@ -1,7 +1,6 @@
package integration
import (
- "fmt"
"os"
"path/filepath"
@@ -23,14 +22,15 @@ var _ = Describe("Podman save", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman save output flag", func() {
diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go
index 167f8fa25..589389b3b 100644
--- a/test/e2e/search_test.go
+++ b/test/e2e/search_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
"strconv"
@@ -44,14 +43,15 @@ var _ = Describe("Podman search", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman search", func() {
@@ -134,6 +134,9 @@ var _ = Describe("Podman search", func() {
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
+ lock := GetPortLock("5000")
+ defer lock.Unlock()
+
podmanTest.RestoreArtifact(registry)
fakereg := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"})
fakereg.WaitWithDefaultTimeout()
@@ -157,6 +160,8 @@ var _ = Describe("Podman search", func() {
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
+ lock := GetPortLock("5000")
+ defer lock.Unlock()
podmanTest.RestoreArtifact(registry)
registry := podmanTest.Podman([]string{"run", "-d", "--name", "registry3", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"})
registry.WaitWithDefaultTimeout()
@@ -180,6 +185,8 @@ var _ = Describe("Podman search", func() {
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
+ lock := GetPortLock("5000")
+ defer lock.Unlock()
podmanTest.RestoreArtifact(registry)
registry := podmanTest.Podman([]string{"run", "-d", "--name", "registry4", "-p", "5000:5000", registry, "/entrypoint.sh", "/etc/docker/registry/config.yml"})
registry.WaitWithDefaultTimeout()
@@ -212,6 +219,8 @@ var _ = Describe("Podman search", func() {
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
+ lock := GetPortLock("5000")
+ defer lock.Unlock()
podmanTest.RestoreArtifact(registry)
registry := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry5", registry})
registry.WaitWithDefaultTimeout()
@@ -243,6 +252,8 @@ var _ = Describe("Podman search", func() {
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
+ lock := GetPortLock("5000")
+ defer lock.Unlock()
podmanTest.RestoreArtifact(registry)
registry := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry6", registry})
registry.WaitWithDefaultTimeout()
@@ -274,6 +285,8 @@ var _ = Describe("Podman search", func() {
if podmanTest.Host.Arch == "ppc64le" {
Skip("No registry image for ppc64le")
}
+ lock := GetPortLock("5000")
+ defer lock.Unlock()
podmanTest.RestoreArtifact(registry)
registryLocal := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry7", registry})
registryLocal.WaitWithDefaultTimeout()
diff --git a/test/e2e/start_test.go b/test/e2e/start_test.go
index c4ed6f545..28f1c2393 100644
--- a/test/e2e/start_test.go
+++ b/test/e2e/start_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman start", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman start bogus container", func() {
@@ -50,6 +50,16 @@ var _ = Describe("Podman start", func() {
Expect(session.ExitCode()).To(Equal(0))
})
+ It("podman container start single container by id", func() {
+ session := podmanTest.Podman([]string{"container", "create", "-d", ALPINE, "ls"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ cid := session.OutputToString()
+ session = podmanTest.Podman([]string{"container", "start", cid})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
It("podman start single container by name", func() {
session := podmanTest.Podman([]string{"create", "-d", "--name", "foobar99", ALPINE, "ls"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go
index e7b0b5f6e..05f24539f 100644
--- a/test/e2e/stats_test.go
+++ b/test/e2e/stats_test.go
@@ -19,19 +19,21 @@ var _ = Describe("Podman stats", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman stats with bogus container", func() {
diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go
index 8fffedbb9..97c9287b9 100644
--- a/test/e2e/stop_test.go
+++ b/test/e2e/stop_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman stop", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman stop bogus container", func() {
@@ -59,6 +59,15 @@ var _ = Describe("Podman stop", func() {
Expect(session.ExitCode()).To(Equal(0))
})
+ It("podman stop container by name", func() {
+ session := podmanTest.RunTopContainer("test1")
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"container", "stop", "test1"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+
It("podman stop stopped container", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
@@ -73,7 +82,7 @@ var _ = Describe("Podman stop", func() {
Expect(session3.ExitCode()).To(Equal(0))
})
- It("podman stop all containers", func() {
+ It("podman stop all containers -t", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
@@ -98,6 +107,32 @@ var _ = Describe("Podman stop", func() {
Expect(output).To(ContainSubstring(cid3))
})
+ It("podman stop container --time", func() {
+ session := podmanTest.RunTopContainer("test4")
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ cid1 := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"stop", "--time", "1", "test4"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ output := session.OutputToString()
+ Expect(output).To(ContainSubstring(cid1))
+ })
+
+ It("podman stop container --timeout", func() {
+ session := podmanTest.RunTopContainer("test5")
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ cid1 := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"stop", "--timeout", "1", "test5"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ output := session.OutputToString()
+ Expect(output).To(ContainSubstring(cid1))
+ })
+
It("podman stop latest containers", func() {
session := podmanTest.RunTopContainer("test1")
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/system_df_test.go b/test/e2e/system_df_test.go
new file mode 100644
index 000000000..92787f17c
--- /dev/null
+++ b/test/e2e/system_df_test.go
@@ -0,0 +1,62 @@
+// +build !remoteclient
+
+package integration
+
+import (
+ "fmt"
+ "os"
+ "strings"
+
+ . "github.com/containers/libpod/test/utils"
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+)
+
+var _ = Describe("podman system df", func() {
+ var (
+ tempdir string
+ err error
+ podmanTest *PodmanTestIntegration
+ )
+
+ BeforeEach(func() {
+ tempdir, err = CreateTempDirInTempDir()
+ if err != nil {
+ os.Exit(1)
+ }
+ podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.RestoreAllArtifacts()
+ })
+
+ AfterEach(func() {
+ podmanTest.Cleanup()
+ f := CurrentGinkgoTestDescription()
+ timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
+ GinkgoWriter.Write([]byte(timedResult))
+ })
+
+ It("podman system df", func() {
+ session := podmanTest.Podman([]string{"create", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"volume", "create", "data"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"create", "-v", "data:/data", "--name", "container1", "busybox"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"system", "df"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(4))
+ images := strings.Fields(session.OutputToStringArray()[1])
+ containers := strings.Fields(session.OutputToStringArray()[2])
+ volumes := strings.Fields(session.OutputToStringArray()[3])
+ Expect(images[1]).To(Equal("2"))
+ Expect(containers[1]).To(Equal("2"))
+ Expect(volumes[2]).To(Equal("1"))
+ })
+})
diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go
index 252361288..52efc9fca 100644
--- a/test/e2e/systemd_test.go
+++ b/test/e2e/systemd_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"io/ioutil"
"os"
@@ -21,11 +20,13 @@ var _ = Describe("Podman systemd", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
systemd_unit_file = `[Unit]
Description=redis container
@@ -42,8 +43,8 @@ WantedBy=multi-user.target
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman start container by systemd", func() {
diff --git a/test/e2e/tag_test.go b/test/e2e/tag_test.go
index 9f67eaf80..ff0ac31c4 100644
--- a/test/e2e/tag_test.go
+++ b/test/e2e/tag_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman tag", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman tag shortname:latest", func() {
diff --git a/test/e2e/top_test.go b/test/e2e/top_test.go
index 067358468..2d3a5629c 100644
--- a/test/e2e/top_test.go
+++ b/test/e2e/top_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman top", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman top without container name or id", func() {
@@ -65,6 +65,17 @@ var _ = Describe("Podman top", func() {
Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
})
+ It("podman container top on container", func() {
+ session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "top", "-d", "2"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ result := podmanTest.Podman([]string{"container", "top", "-l"})
+ result.WaitWithDefaultTimeout()
+ Expect(result.ExitCode()).To(Equal(0))
+ Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
+ })
+
It("podman top with options", func() {
session := podmanTest.Podman([]string{"run", "-d", ALPINE, "top", "-d", "2"})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/tree_test.go b/test/e2e/tree_test.go
new file mode 100644
index 000000000..9740adada
--- /dev/null
+++ b/test/e2e/tree_test.go
@@ -0,0 +1,64 @@
+package integration
+
+import (
+ "fmt"
+ "os"
+
+ . "github.com/containers/libpod/test/utils"
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+)
+
+var _ = Describe("Podman image tree", func() {
+ var (
+ tempdir string
+ err error
+ podmanTest *PodmanTestIntegration
+ )
+
+ BeforeEach(func() {
+ tempdir, err = CreateTempDirInTempDir()
+ if err != nil {
+ os.Exit(1)
+ }
+ podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.RestoreAllArtifacts()
+ })
+
+ AfterEach(func() {
+ podmanTest.Cleanup()
+ f := CurrentGinkgoTestDescription()
+ timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
+ GinkgoWriter.Write([]byte(timedResult))
+ })
+
+ It("podman image tree", func() {
+ if podmanTest.RemoteTest {
+ Skip("Does not work on remote client")
+ }
+ session := podmanTest.Podman([]string{"pull", "docker.io/library/busybox:latest"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ dockerfile := `FROM docker.io/library/busybox:latest
+RUN mkdir hello
+RUN touch test.txt
+ENV foo=bar
+`
+ podmanTest.BuildImage(dockerfile, "test:latest", "true")
+
+ session = podmanTest.Podman([]string{"image", "tree", "test:latest"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"image", "tree", "--whatrequires", "docker.io/library/busybox:latest"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"rmi", "test:latest"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"rmi", "docker.io/library/busybox:latest"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
+})
diff --git a/test/e2e/trust_test.go b/test/e2e/trust_test.go
index 0d36266f6..493c4a7d5 100644
--- a/test/e2e/trust_test.go
+++ b/test/e2e/trust_test.go
@@ -4,7 +4,6 @@ package integration
import (
"encoding/json"
- "fmt"
"io/ioutil"
"os"
"path/filepath"
@@ -27,14 +26,15 @@ var _ = Describe("Podman trust", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman image trust show", func() {
diff --git a/test/e2e/version_test.go b/test/e2e/version_test.go
index 68a462bdb..f546158a9 100644
--- a/test/e2e/version_test.go
+++ b/test/e2e/version_test.go
@@ -1,7 +1,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -27,8 +26,8 @@ var _ = Describe("Podman version", func() {
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman version", func() {
@@ -37,4 +36,24 @@ var _ = Describe("Podman version", func() {
Expect(session.ExitCode()).To(Equal(0))
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 2))
})
+
+ It("podman version --format json", func() {
+ session := podmanTest.Podman([]string{"version", "--format", "json"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.IsJSONOutputValid()).To(BeTrue())
+ })
+
+ It("podman version --format json", func() {
+ session := podmanTest.Podman([]string{"version", "--format", "{{ json .}}"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.IsJSONOutputValid()).To(BeTrue())
+ })
+
+ It("podman version --format GO template", func() {
+ session := podmanTest.Podman([]string{"version", "--format", "{{ .Version }}"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ })
})
diff --git a/test/e2e/volume_create_test.go b/test/e2e/volume_create_test.go
index 50ee63f2a..dccecd457 100644
--- a/test/e2e/volume_create_test.go
+++ b/test/e2e/volume_create_test.go
@@ -1,7 +1,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -22,14 +21,15 @@ var _ = Describe("Podman volume create", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupVolume()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman create volume", func() {
diff --git a/test/e2e/volume_inspect_test.go b/test/e2e/volume_inspect_test.go
index d0d5a601e..e7f20ce7b 100644
--- a/test/e2e/volume_inspect_test.go
+++ b/test/e2e/volume_inspect_test.go
@@ -1,7 +1,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -22,14 +21,15 @@ var _ = Describe("Podman volume inspect", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupVolume()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman inspect volume", func() {
diff --git a/test/e2e/volume_ls_test.go b/test/e2e/volume_ls_test.go
index 119d29d9b..1f0177def 100644
--- a/test/e2e/volume_ls_test.go
+++ b/test/e2e/volume_ls_test.go
@@ -1,7 +1,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -22,14 +21,15 @@ var _ = Describe("Podman volume ls", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupVolume()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman ls volume", func() {
diff --git a/test/e2e/volume_prune_test.go b/test/e2e/volume_prune_test.go
index 802f3fc4a..55a95c8c9 100644
--- a/test/e2e/volume_prune_test.go
+++ b/test/e2e/volume_prune_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman volume prune", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupVolume()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman prune volume", func() {
diff --git a/test/e2e/volume_rm_test.go b/test/e2e/volume_rm_test.go
index 6a1e7d0e8..888474670 100644
--- a/test/e2e/volume_rm_test.go
+++ b/test/e2e/volume_rm_test.go
@@ -1,7 +1,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -22,14 +21,15 @@ var _ = Describe("Podman volume rm", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.CleanupVolume()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman rm volume", func() {
diff --git a/test/e2e/wait_test.go b/test/e2e/wait_test.go
index 08da97aa0..5bf0331e5 100644
--- a/test/e2e/wait_test.go
+++ b/test/e2e/wait_test.go
@@ -3,7 +3,6 @@
package integration
import (
- "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -24,14 +23,15 @@ var _ = Describe("Podman wait", func() {
os.Exit(1)
}
podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.Setup()
podmanTest.RestoreAllArtifacts()
})
AfterEach(func() {
podmanTest.Cleanup()
f := CurrentGinkgoTestDescription()
- timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
- GinkgoWriter.Write([]byte(timedResult))
+ processTestResult(f)
+
})
It("podman wait on bogus container", func() {
@@ -66,4 +66,11 @@ var _ = Describe("Podman wait", func() {
session = podmanTest.Podman([]string{"wait", "-l"})
session.Wait(20)
})
+ It("podman container wait on latest container", func() {
+ session := podmanTest.Podman([]string{"container", "run", "-d", ALPINE, "sleep", "1"})
+ session.Wait(20)
+ Expect(session.ExitCode()).To(Equal(0))
+ session = podmanTest.Podman([]string{"container", "wait", "-l"})
+ session.Wait(20)
+ })
})