summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/certs/README.md9
-rw-r--r--test/certs/domain.cfg30
-rw-r--r--test/certs/domain.crt47
-rw-r--r--test/certs/domain.key45
-rw-r--r--test/e2e/common_test.go5
-rw-r--r--test/e2e/create_staticip_test.go1
-rw-r--r--test/e2e/e2e.coverprofile18
-rw-r--r--test/e2e/generate_kube_test.go4
-rw-r--r--test/e2e/healthcheck_run_test.go1
-rw-r--r--test/e2e/info_test.go2
-rw-r--r--test/e2e/inspect_test.go10
-rw-r--r--test/e2e/libpod_suite_remoteclient_test.go9
-rw-r--r--test/e2e/libpod_suite_test.go13
-rw-r--r--test/e2e/logs_test.go38
-rw-r--r--test/e2e/pause_test.go1
-rw-r--r--test/e2e/pod_create_test.go4
-rw-r--r--test/e2e/pod_pause_test.go1
-rw-r--r--test/e2e/pod_stats_test.go1
-rw-r--r--test/e2e/ps_test.go19
-rw-r--r--test/e2e/push_test.go1
-rw-r--r--test/e2e/rm_test.go14
-rw-r--r--test/e2e/rootless_test.go16
-rw-r--r--test/e2e/run_cgroup_parent_test.go1
-rw-r--r--test/e2e/run_cpu_test.go6
-rw-r--r--test/e2e/run_device_test.go5
-rw-r--r--test/e2e/run_dns_test.go1
-rw-r--r--test/e2e/run_memory_test.go1
-rw-r--r--test/e2e/run_networking_test.go5
-rw-r--r--test/e2e/run_ns_test.go2
-rw-r--r--test/e2e/run_privileged_test.go3
-rw-r--r--test/e2e/run_selinux_test.go2
-rw-r--r--test/e2e/run_staticip_test.go1
-rw-r--r--test/e2e/run_test.go19
-rw-r--r--test/e2e/run_userns_test.go1
-rw-r--r--test/e2e/stats_test.go1
-rw-r--r--test/e2e/systemd_test.go1
-rw-r--r--test/e2e/version_test.go20
-rw-r--r--test/system/000-TEMPLATE2
-rw-r--r--test/system/015-help.bats19
-rw-r--r--test/system/035-logs.bats27
-rw-r--r--test/system/060-mount.bats2
-rw-r--r--test/system/075-exec.bats30
-rw-r--r--test/system/120-load.bats96
-rw-r--r--test/system/200-pod-top.bats14
-rw-r--r--test/system/300-cli-parsing.bats15
-rw-r--r--test/test_podman_build.sh7
46 files changed, 525 insertions, 45 deletions
diff --git a/test/certs/README.md b/test/certs/README.md
new file mode 100644
index 000000000..3aab01440
--- /dev/null
+++ b/test/certs/README.md
@@ -0,0 +1,9 @@
+# How to generate key and cert:
+
+## Make private key without a password
+
+certtool --rsa --generate-privkey --null-password --outfile=domain.key
+
+## Use ``domain.cfg`` template to make self-signed cert
+
+certtool --generate-self-signed --load-privkey=domain.key --template=domain.cfg --outfile=domain.crt --load-ca-privkey=domain.key --null-password --no-text
diff --git a/test/certs/domain.cfg b/test/certs/domain.cfg
new file mode 100644
index 000000000..5baeb5631
--- /dev/null
+++ b/test/certs/domain.cfg
@@ -0,0 +1,30 @@
+# X.509 Certificate options
+organization = "Koko inc."
+unit = "sleeping dept."
+locality = "foobar"
+state = "Attiki"
+country = GR
+cn = "Cindy Lauper"
+uid = "clauper"
+dc = "name"
+dc = "domain"
+serial = 1234
+dns_name = "localhost"
+# Use -1 if there is no expiration date.
+expiration_days = -1
+email = "none@none.org"
+signing_key
+encryption_key
+cert_signing_key
+crl_signing_key
+data_encipherment
+non_repudiation
+tls_www_client
+tls_www_server
+code_signing_key
+ocsp_signing_key
+time_stamping_key
+email_protection_key
+ipsec_ike_key
+# for any purpose (must not be used in intermediate CA certificates)
+key_purpose_oid = 2.5.29.37.0
diff --git a/test/certs/domain.crt b/test/certs/domain.crt
index 881fc124d..8a697d7b2 100644
--- a/test/certs/domain.crt
+++ b/test/certs/domain.crt
@@ -1,18 +1,33 @@
-----BEGIN CERTIFICATE-----
-MIIC3zCCAmSgAwIBAgIUdbnvx7lLf8OANP37QTKoxfNAl5EwCgYIKoZIzj0EAwMw
-gawxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1T
-YW4gRnJhbmNpc2NvMSowKAYDVQQKEyF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AwkGCCsGAQUFBwMDBggrBgEFBQcDCAYIKwYBBQUHAwQw
+DAYDVR0TAQH/BAIwADAUBgNVHREEDTALgglsb2NhbGhvc3QwDwYDVR0PAQH/BAUD
+AwfwADAdBgNVHQ4EFgQU28OkcdKIoWfHK19QXiFCYud345YwDQYJKoZIhvcNAQEL
+BQADggGBAJyA0YiSiCzVS6M+/2hEvKamlYUz6L7pb5fdlQ3dPL/KlbUPc31bLD7b
+G3Su9iz1bL1qVGebgoJTEDOD/6F9DbMY4Nsh4oe1rS+eBZe6fG6VnaxE4U2XIWKD
+0aijGGfUvEB8W66BtCrtjY3bAb9v1OLvLxktd9do4ACjskq+q+CE/8ID9tCkAn8J
+q0aHv5a5H3bPu3WGuiifZHER+08OwEsO7jsnZAJdgrAK8D0Rodd1rbdIFh2klu1p
+LOCCMhgrQtCFVhoqWA2XaGexqmlTTXjabFDyMA8RvdKozwLSpyMMHJX6Q38Wdr8Z
+nAXfqkCAcXuVwk2llAW7f073Ze3xFWUiW6gH0w7H1KvHHkglBM4H3HyG2T2pu9lb
+mrqRRnfx2AuQplUrFVvz5V7sKmTwZCPueXkfcv/+6bxcLA0N0p3Dk+LGc2JzBLFb
+n6AzrjKwiEg5ri4dQEuaYnJAYDvp+/vo4AEPrUc9nKwOo1h+3rAY2ZkuCy06/3cj
+nzp56Tpaaw==
-----END CERTIFICATE-----
diff --git a/test/certs/domain.key b/test/certs/domain.key
index b0f15eb75..4fe293cac 100644
--- a/test/certs/domain.key
+++ b/test/certs/domain.key
@@ -1,6 +1,39 @@
------BEGIN EC PRIVATE KEY-----
-MIGkAgEBBDB7ZI5Q6dOSwOqpJ2FVlFuDJN/sJB3epR2S+rOvCPua+rQ8uv6lpZDx
-CQ4ioUMFo6agBwYFK4EEACKhZANiAATA65F+T8sreSnTm+I2IjeKN8rb5W2j3QKX
-z8n9JkPWiWX16HGIWso1JWPhhjvpmVkfSzD91niQwrsm6PhPypZUzkX5iL7JE8jV
-jflEiUbflSzc+fgT/scq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y2vFQVUfWFZYBC
+Nc6oBS/tPQIDi3LHc0Z1/0TvqDwnbWmgYu71oJ8yu+3bB0MCgcB0katYynavMg3W
+w15sH/1+be5dFTXZoiajjqXmYDNkZzyLoghteu/eyxqFw8Au4hyVy5koYHN/jrzf
+1ZfXFCs3P5asCAptTH3kwgT/ER58KPOoq7cGEaut9eQ1UAc8E34b/ZISbTl/Zw05
+swOMC6ipzn70kNoPcjJN2ujSUCD9t0NKyyCAKokjFICGpCHDOdOwqtZRbKFVFSix
+/T4HAV9puGT6kDMCtjLyZ+fUOf9hgCHK3sBkBt5XrU8j6Wf/zyg=
+-----END RSA PRIVATE KEY-----
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index afd6d3cf3..54b2cbec2 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -3,6 +3,7 @@ package integration
import (
"encoding/json"
"fmt"
+ "github.com/containers/libpod/pkg/rootless"
"io/ioutil"
"os"
"os/exec"
@@ -213,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")
}
diff --git a/test/e2e/create_staticip_test.go b/test/e2e/create_staticip_test.go
index a67c1a5a8..6c4ca1cb8 100644
--- a/test/e2e/create_staticip_test.go
+++ b/test/e2e/create_staticip_test.go
@@ -18,6 +18,7 @@ var _ = Describe("Podman create with --ip flag", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
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/generate_kube_test.go b/test/e2e/generate_kube_test.go
index 2f0af7e5f..5bcf3b347 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -48,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))
@@ -61,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))
@@ -74,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))
@@ -90,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
index 921d325c3..f178e8ad5 100644
--- a/test/e2e/healthcheck_run_test.go
+++ b/test/e2e/healthcheck_run_test.go
@@ -42,6 +42,7 @@ var _ = Describe("Podman healthcheck run", func() {
})
It("podman healthcheck on valid container", func() {
+ SkipIfRootless()
podmanTest.RestoreArtifact(healthcheck)
session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", healthcheck})
session.WaitWithDefaultTimeout()
diff --git a/test/e2e/info_test.go b/test/e2e/info_test.go
index 046297bc0..c960fb311 100644
--- a/test/e2e/info_test.go
+++ b/test/e2e/info_test.go
@@ -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 ebe610e6a..34328828f 100644
--- a/test/e2e/inspect_test.go
+++ b/test/e2e/inspect_test.go
@@ -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/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 1a3f37e23..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 {
diff --git a/test/e2e/logs_test.go b/test/e2e/logs_test.go
index b7d959de9..d051e3dba 100644
--- a/test/e2e/logs_test.go
+++ b/test/e2e/logs_test.go
@@ -4,6 +4,7 @@ package integration
import (
"os"
+ "strings"
. "github.com/containers/libpod/test/utils"
. "github.com/onsi/ginkgo"
@@ -34,7 +35,6 @@ var _ = Describe("Podman logs", func() {
})
- //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/pause_test.go b/test/e2e/pause_test.go
index 2d4c1d303..e28c31c3a 100644
--- a/test/e2e/pause_test.go
+++ b/test/e2e/pause_test.go
@@ -22,6 +22,7 @@ var _ = Describe("Podman pause", func() {
createdState := "Created"
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index 5ffc0f779..de0734e9f 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -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_pause_test.go b/test/e2e/pod_pause_test.go
index 62dc919b6..59a4da176 100644
--- a/test/e2e/pod_pause_test.go
+++ b/test/e2e/pod_pause_test.go
@@ -20,6 +20,7 @@ var _ = Describe("Podman pod pause", func() {
pausedState := "Paused"
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/pod_stats_test.go b/test/e2e/pod_stats_test.go
index ceabb9dc1..6018b4494 100644
--- a/test/e2e/pod_stats_test.go
+++ b/test/e2e/pod_stats_test.go
@@ -18,6 +18,7 @@ var _ = Describe("Podman pod stats", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index 58697acde..957c69aa8 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -82,6 +82,8 @@ var _ = Describe("Podman ps", func() {
})
It("podman ps size flag", func() {
+ SkipIfRootless()
+
_, ec, _ := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))
@@ -233,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))
@@ -303,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/push_test.go b/test/e2e/push_test.go
index 89df62d42..009067482 100644
--- a/test/e2e/push_test.go
+++ b/test/e2e/push_test.go
@@ -80,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")
}
diff --git a/test/e2e/rm_test.go b/test/e2e/rm_test.go
index 1f67780da..9bf742a63 100644
--- a/test/e2e/rm_test.go
+++ b/test/e2e/rm_test.go
@@ -139,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/rootless_test.go b/test/e2e/rootless_test.go
index cd771e2ba..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)
@@ -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)
})
diff --git a/test/e2e/run_cgroup_parent_test.go b/test/e2e/run_cgroup_parent_test.go
index a6955591f..0d04c5f03 100644
--- a/test/e2e/run_cgroup_parent_test.go
+++ b/test/e2e/run_cgroup_parent_test.go
@@ -18,6 +18,7 @@ var _ = Describe("Podman run with --cgroup-parent", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/run_cpu_test.go b/test/e2e/run_cpu_test.go
index a2dd5b9b8..42a66865c 100644
--- a/test/e2e/run_cpu_test.go
+++ b/test/e2e/run_cpu_test.go
@@ -35,6 +35,7 @@ var _ = Describe("Podman run cpu", func() {
})
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 5f59fbe37..fac09b78d 100644
--- a/test/e2e/run_device_test.go
+++ b/test/e2e/run_device_test.go
@@ -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))
@@ -74,6 +78,7 @@ var _ = Describe("Podman run device", func() {
})
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"})
diff --git a/test/e2e/run_dns_test.go b/test/e2e/run_dns_test.go
index 875c90d73..0f4dd6742 100644
--- a/test/e2e/run_dns_test.go
+++ b/test/e2e/run_dns_test.go
@@ -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_memory_test.go b/test/e2e/run_memory_test.go
index 790cdf743..05d0b7a18 100644
--- a/test/e2e/run_memory_test.go
+++ b/test/e2e/run_memory_test.go
@@ -18,6 +18,7 @@ var _ = Describe("Podman run memory", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index 80378dc7b..93919925c 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -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 51f921bce..5236e6584 100644
--- a/test/e2e/run_ns_test.go
+++ b/test/e2e/run_ns_test.go
@@ -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_privileged_test.go b/test/e2e/run_privileged_test.go
index a4500e421..16011b2fd 100644
--- a/test/e2e/run_privileged_test.go
+++ b/test/e2e/run_privileged_test.go
@@ -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_selinux_test.go b/test/e2e/run_selinux_test.go
index 282806562..4d2bad49c 100644
--- a/test/e2e/run_selinux_test.go
+++ b/test/e2e/run_selinux_test.go
@@ -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_staticip_test.go b/test/e2e/run_staticip_test.go
index 464f9513a..318a7a62d 100644
--- a/test/e2e/run_staticip_test.go
+++ b/test/e2e/run_staticip_test.go
@@ -18,6 +18,7 @@ var _ = Describe("Podman run with --ip flag", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index e0d2e21b7..b0dc66707 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -47,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"})
@@ -151,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"})
@@ -185,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()
@@ -211,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)
@@ -275,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))
@@ -282,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")
}
@@ -292,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))
@@ -299,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))
@@ -306,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))
@@ -313,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))
@@ -416,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())
@@ -430,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))
@@ -437,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))
@@ -444,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))
@@ -458,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))
@@ -465,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))
diff --git a/test/e2e/run_userns_test.go b/test/e2e/run_userns_test.go
index b67b694b0..c6c94d2f6 100644
--- a/test/e2e/run_userns_test.go
+++ b/test/e2e/run_userns_test.go
@@ -18,6 +18,7 @@ var _ = Describe("Podman UserNS support", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/stats_test.go b/test/e2e/stats_test.go
index e95265617..05f24539f 100644
--- a/test/e2e/stats_test.go
+++ b/test/e2e/stats_test.go
@@ -19,6 +19,7 @@ var _ = Describe("Podman stats", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/systemd_test.go b/test/e2e/systemd_test.go
index 558635d70..52efc9fca 100644
--- a/test/e2e/systemd_test.go
+++ b/test/e2e/systemd_test.go
@@ -20,6 +20,7 @@ var _ = Describe("Podman systemd", func() {
)
BeforeEach(func() {
+ SkipIfRootless()
tempdir, err = CreateTempDirInTempDir()
if err != nil {
os.Exit(1)
diff --git a/test/e2e/version_test.go b/test/e2e/version_test.go
index b66291734..f546158a9 100644
--- a/test/e2e/version_test.go
+++ b/test/e2e/version_test.go
@@ -36,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/system/000-TEMPLATE b/test/system/000-TEMPLATE
index 296ed4d58..85e25e921 100644
--- a/test/system/000-TEMPLATE
+++ b/test/system/000-TEMPLATE
@@ -52,7 +52,7 @@ function teardown() {
@test "podman FOO - description of test" {
# FIXME: please try to remove this line; that is, try to write tests
# that will pass as both root and rootless.
- skip_if_rootless
+ skip_if_rootless "Short explanation of why this doesn't work rootless"
# FIXME: template for run commands. Always use 'run_podman'!
# FIXME: The '?' means 'ignore exit status'; use a number if you
diff --git a/test/system/015-help.bats b/test/system/015-help.bats
index b648599f7..8e07b8822 100644
--- a/test/system/015-help.bats
+++ b/test/system/015-help.bats
@@ -46,15 +46,34 @@ function check_help() {
# Confirm that by running with 'invalid-arg' and expecting failure.
if expr "$usage" : '.*\[flags\]$' >/dev/null; then
if [ "$cmd" != "help" ]; then
+ dprint "podman $@ $cmd invalid-arg"
run_podman 125 "$@" $cmd invalid-arg
is "$output" "Error: .* takes no arguments" \
"'podman $@ $cmd' with extra (invalid) arguments"
fi
fi
+ # If usage has required arguments, try running without them
+ if expr "$usage" : '.*\[flags\] [A-Z]' >/dev/null; then
+ dprint "podman $@ $cmd (without required args)"
+ run_podman 125 "$@" $cmd
+ is "$output" "Error:"
+ fi
+
count=$(expr $count + 1)
done
+ # Any command that takes subcommands, must throw error if called
+ # without one.
+ dprint "podman $@"
+ run_podman 125 "$@"
+ is "$output" "Error: missing command .*$@ COMMAND"
+
+ # Assume that 'NoSuchCommand' is not a command
+ dprint "podman $@ NoSuchCommand"
+ run_podman 125 "$@" NoSuchCommand
+ is "$output" "Error: unrecognized command .*$@ NoSuchCommand"
+
# This can happen if the output of --help changes, such as between
# the old command parser and cobra.
[ $count -gt 0 ] || \
diff --git a/test/system/035-logs.bats b/test/system/035-logs.bats
index debec29b6..055865c8d 100644
--- a/test/system/035-logs.bats
+++ b/test/system/035-logs.bats
@@ -18,7 +18,34 @@ load helpers
is "$output" "$rand_string" "output from podman-start on created ctr"
is "$output" "$rand_string" "logs of started container"
+ run_podman logs $cid
+ is "$output" "$rand_string" "output from podman-logs after container is run"
+
run_podman rm $cid
}
+@test "podman logs - multi" {
+ # Simple helper to make the container starts, below, easier to read
+ local -a cid
+ doit() {
+ run_podman run --rm -d --name "$1" $IMAGE sh -c "$2";
+ cid+=($(echo "${output:0:12}"))
+ }
+
+ # Not really a guarantee that we'll get a-b-c-d in order, but it's
+ # the best we can do. The trailing 'sleep' in each container
+ # minimizes the chance of a race condition in which the container
+ # is removed before 'podman logs' has a chance to wake up and read
+ # the final output.
+ doit c1 "echo a;sleep 10;echo d;sleep 3"
+ doit c2 "sleep 1;echo b;sleep 2;echo c;sleep 3"
+
+ run_podman logs -f c1 c2
+ is "$output" \
+ "${cid[0]} a
+${cid[1]} b
+${cid[1]} c
+${cid[0]} d" "Sequential output from logs"
+}
+
# vim: filetype=sh
diff --git a/test/system/060-mount.bats b/test/system/060-mount.bats
index 3601b7b84..e249b2883 100644
--- a/test/system/060-mount.bats
+++ b/test/system/060-mount.bats
@@ -5,7 +5,7 @@ load helpers
@test "podman mount - basic test" {
# Only works with root (FIXME: does it work with rootless + vfs?)
- skip_if_rootless
+ skip_if_rootless "mount does not work rootless"
f_path=/tmp/tmpfile_$(random_string 8)
f_content=$(random_string 30)
diff --git a/test/system/075-exec.bats b/test/system/075-exec.bats
new file mode 100644
index 000000000..a12d28b32
--- /dev/null
+++ b/test/system/075-exec.bats
@@ -0,0 +1,30 @@
+#!/usr/bin/env bats -*- bats -*-
+#
+# Tests for podman exec
+#
+
+load helpers
+
+@test "podman exec - basic test" {
+ rand_filename=$(random_string 20)
+ rand_content=$(random_string 50)
+
+ # Start a container. Write random content to random file, then stay
+ # alive as long as file exists. (This test will remove that file soon.)
+ run_podman run -d $IMAGE sh -c \
+ "echo $rand_content >/$rand_filename;echo READY;while [ -f /$rand_filename ]; do sleep 1; done"
+ cid="$output"
+ wait_for_ready $cid
+
+ run_podman exec $cid sh -c "cat /$rand_filename"
+ is "$output" "$rand_content" "Can exec and see file in running container"
+
+ run_podman exec $cid rm -f /$rand_filename
+
+ run_podman wait $cid
+ is "$output" "0" "output from podman wait (container exit code)"
+
+ run_podman rm $cid
+}
+
+# vim: filetype=sh
diff --git a/test/system/120-load.bats b/test/system/120-load.bats
new file mode 100644
index 000000000..dedfe6172
--- /dev/null
+++ b/test/system/120-load.bats
@@ -0,0 +1,96 @@
+#!/usr/bin/env bats -*- bats -*-
+#
+# tests for podman load
+#
+
+load helpers
+
+# Custom helpers for this test only. These just save us having to duplicate
+# the same thing four times (two tests, each with -i and stdin).
+#
+# initialize, read image ID and name
+get_iid_and_name() {
+ run_podman images --format '{{.ID}} {{.Repository}}:{{.Tag}}'
+ read iid img_name < <(echo "$output")
+
+ archive=$PODMAN_TMPDIR/myimage-$(random_string 8).tar
+}
+
+# Simple verification of image ID and name
+verify_iid_and_name() {
+ run_podman images --format '{{.ID}} {{.Repository}}:{{.Tag}}'
+ read new_iid new_img_name < <(echo "$output")
+
+ # Verify
+ is "$new_iid" "$iid" "Image ID of loaded image == original"
+ is "$new_img_name" "$1" "Name & tag of restored image"
+}
+
+
+@test "podman load - by image ID" {
+ # FIXME: how to build a simple archive instead?
+ get_iid_and_name
+
+ # Save image by ID, and remove it.
+ run_podman save $iid -o $archive
+ run_podman rmi $iid
+
+ # Load using -i; IID should be preserved, but name is not.
+ run_podman load -i $archive
+ verify_iid_and_name "<none>:<none>"
+
+ # Same as above, using stdin
+ run_podman rmi $iid
+ run_podman load < $archive
+ verify_iid_and_name "<none>:<none>"
+
+ # Cleanup: since load-by-iid doesn't preserve name, re-tag it;
+ # otherwise our global teardown will rmi and re-pull our standard image.
+ run_podman tag $iid $img_name
+}
+
+@test "podman load - by image name" {
+ get_iid_and_name
+ run_podman save $img_name -o $archive
+ run_podman rmi $iid
+
+ # Load using -i; this time the image should be tagged.
+ run_podman load -i $archive
+ verify_iid_and_name $img_name
+
+ # Same as above, using stdin
+ run_podman rmi $iid
+ run_podman load < $archive
+ verify_iid_and_name $img_name
+}
+
+@test "podman load - NAME and NAME:TAG arguments work (requires: #2674)" {
+ get_iid_and_name
+ run_podman save $iid -o $archive
+ run_podman rmi $iid
+
+ # Load with just a name (note: names must be lower-case)
+ random_name=$(random_string 20 | tr A-Z a-z)
+ run_podman load -i $archive $random_name
+ verify_iid_and_name "localhost/$random_name:latest"
+
+ # Load with NAME:TAG arg
+ run_podman rmi $iid
+ random_tag=$(random_string 10 | tr A-Z a-z)
+ run_podman load -i $archive $random_name:$random_tag
+ verify_iid_and_name "localhost/$random_name:$random_tag"
+
+ # Cleanup: restore desired image name
+ run_podman tag $iid $img_name
+ run_podman rmi "$random_name:$random_tag"
+}
+
+
+@test "podman load - will not read from tty" {
+ run_podman 125 load
+ is "$output" \
+ "Error: cannot read from terminal. Use command-line redirection" \
+ "Diagnostic from 'podman load' without redirection or -i"
+}
+
+# vim: filetype=sh
diff --git a/test/system/200-pod-top.bats b/test/system/200-pod-top.bats
index 81c4be3ff..0200df00d 100644
--- a/test/system/200-pod-top.bats
+++ b/test/system/200-pod-top.bats
@@ -3,9 +3,10 @@
load helpers
@test "podman pod top - containers in different PID namespaces" {
- skip_if_rootless
-
- run_podman pod create
+ # With infra=false, we don't get a /pause container (we also
+ # don't pull k8s.gcr.io/pause )
+ no_infra='--infra=false'
+ run_podman pod create $no_infra
podid="$output"
# Start two containers...
@@ -23,11 +24,14 @@ load helpers
run_podman pod top $podid
is "$output" ".*root.*top -d 2.*root.*top -d 2" "two 'top' containers"
- # There should be a /pause container
+ # By default (podman pod create w/ default --infra) there should be
+ # a /pause container.
# FIXME: sometimes there is, sometimes there isn't. If anyone ever
# actually figures this out, please either reenable this line or
# remove it entirely.
- #is "$output" ".*0 \+1 \+0 \+[0-9. ?s]\+/pause" "there is a /pause container"
+ if [ -z "$no_infra" ]; then
+ is "$output" ".*0 \+1 \+0 \+[0-9. ?s]\+/pause" "there is a /pause container"
+ fi
# Clean up
run_podman pod rm -f $podid
diff --git a/test/system/300-cli-parsing.bats b/test/system/300-cli-parsing.bats
new file mode 100644
index 000000000..92c073102
--- /dev/null
+++ b/test/system/300-cli-parsing.bats
@@ -0,0 +1,15 @@
+#!/usr/bin/env bats -*- bats -*-
+#
+# Various command-line parsing regression tests that don't fit in elsewhere
+#
+
+load helpers
+
+@test "podman cli parsing - quoted args - #2574" {
+ # 1.1.2 fails with:
+ # Error: invalid argument "true=\"false\"" for "-l, --label" \
+ # flag: parse error on line 1, column 5: bare " in non-quoted-field
+ run_podman run --rm --label 'true="false"' $IMAGE true
+}
+
+# vim: filetype=sh
diff --git a/test/test_podman_build.sh b/test/test_podman_build.sh
index 9faefc78a..39f1e784d 100644
--- a/test/test_podman_build.sh
+++ b/test/test_podman_build.sh
@@ -34,6 +34,13 @@ echo ########################################################
echo ########################################################
+echo test "build directory before other options create a tag"
+echo ########################################################
+TARGET=tagged-image
+podman build $HOME/test/build/from-scratch --quiet=True -t $TARGET
+podman images | grep tagged-image
+
+echo ########################################################
echo test "build-preserve-subvolumes"
echo ########################################################
TARGET=volume-image