summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/python/rest_api/test_v2_0_0_container.py2
-rw-r--r--test/apiv2/python/rest_api/test_v2_0_0_image.py5
-rwxr-xr-xtest/compose/test-compose1
-rw-r--r--test/e2e/commit_test.go2
-rw-r--r--test/e2e/common_test.go2
-rw-r--r--test/e2e/config/containers.conf1
-rw-r--r--test/e2e/container_inspect_test.go8
-rw-r--r--test/e2e/containers_conf_test.go8
-rw-r--r--test/e2e/create_test.go2
-rw-r--r--test/e2e/generate_kube_test.go50
-rw-r--r--test/e2e/healthcheck_run_test.go33
-rw-r--r--test/e2e/inspect_test.go4
-rw-r--r--test/e2e/network_connect_disconnect_test.go18
-rw-r--r--test/e2e/network_test.go52
-rw-r--r--test/e2e/play_build_test.go19
-rw-r--r--test/e2e/play_kube_test.go57
-rw-r--r--test/e2e/pod_create_test.go27
-rw-r--r--test/e2e/pod_inspect_test.go4
-rw-r--r--test/e2e/pod_start_test.go4
-rw-r--r--test/e2e/ps_test.go61
-rw-r--r--test/e2e/rename_test.go25
-rw-r--r--test/e2e/run_networking_test.go136
-rw-r--r--test/e2e/run_test.go4
-rw-r--r--test/e2e/run_volume_test.go94
-rw-r--r--test/e2e/stop_test.go11
-rw-r--r--test/e2e/system_connection_test.go4
-rw-r--r--test/e2e/top_test.go6
-rw-r--r--test/system/001-basic.bats3
-rw-r--r--test/system/035-logs.bats31
-rw-r--r--test/system/040-ps.bats32
-rw-r--r--test/system/060-mount.bats2
-rw-r--r--test/system/065-cp.bats43
-rw-r--r--test/system/070-build.bats39
-rw-r--r--test/system/080-pause.bats2
-rw-r--r--test/system/120-load.bats16
-rw-r--r--test/system/160-volumes.bats9
-rw-r--r--test/system/220-healthcheck.bats5
-rw-r--r--test/system/270-socket-activation.bats24
-rw-r--r--test/system/330-corrupt-images.bats2
-rw-r--r--test/system/410-selinux.bats4
-rw-r--r--test/system/420-cgroups.bats4
-rw-r--r--test/system/500-networking.bats8
-rw-r--r--test/system/600-completion.bats4
-rw-r--r--test/system/700-play.bats17
-rw-r--r--test/system/helpers.bash12
-rw-r--r--test/testvol/main.go2
-rw-r--r--test/utils/utils.go15
-rw-r--r--test/version/main.go11
48 files changed, 666 insertions, 259 deletions
diff --git a/test/apiv2/python/rest_api/test_v2_0_0_container.py b/test/apiv2/python/rest_api/test_v2_0_0_container.py
index dbad6824f..853e9da88 100644
--- a/test/apiv2/python/rest_api/test_v2_0_0_container.py
+++ b/test/apiv2/python/rest_api/test_v2_0_0_container.py
@@ -56,7 +56,7 @@ class ContainerTestCase(APITestCase):
self.assertEqual(r.status_code, 200, r.text)
self.assertId(r.content)
out = r.json()
- self.assertIsNone(out["State"].get("Health"))
+ self.assertIsNotNone(out["State"].get("Health"))
self.assertListEqual(["CMD", "pidof", "top"], out["Config"]["Healthcheck"]["Test"])
self.assertEqual(5000000000, out["Config"]["Healthcheck"]["Interval"])
self.assertEqual(2000000000, out["Config"]["Healthcheck"]["Timeout"])
diff --git a/test/apiv2/python/rest_api/test_v2_0_0_image.py b/test/apiv2/python/rest_api/test_v2_0_0_image.py
index bcacaa935..58d03b149 100644
--- a/test/apiv2/python/rest_api/test_v2_0_0_image.py
+++ b/test/apiv2/python/rest_api/test_v2_0_0_image.py
@@ -32,6 +32,9 @@ class ImageTestCase(APITestCase):
for k in required_keys:
self.assertIn(k, item)
+ # Id should be prefixed with sha256: (#11645)
+ self.assertIn("sha256:",item['Id'])
+
def test_inspect(self):
r = requests.get(self.podman_url + "/v1.40/images/alpine/json")
self.assertEqual(r.status_code, 200, r.text)
@@ -59,6 +62,8 @@ class ImageTestCase(APITestCase):
for item in required_keys:
self.assertIn(item, image)
_ = parse(image["Created"])
+ # Id should be prefixed with sha256: (#11645)
+ self.assertIn("sha256:",image['Id'])
def test_delete(self):
r = requests.delete(self.podman_url + "/v1.40/images/alpine?force=true")
diff --git a/test/compose/test-compose b/test/compose/test-compose
index 70db6dd55..beaf276fd 100755
--- a/test/compose/test-compose
+++ b/test/compose/test-compose
@@ -247,6 +247,7 @@ function podman() {
--storage-driver=vfs \
--root $WORKDIR/root \
--runroot $WORKDIR/runroot \
+ --cni-config-dir $WORKDIR/cni \
"$@")
echo -n "$output" >>$WORKDIR/output.log
}
diff --git a/test/e2e/commit_test.go b/test/e2e/commit_test.go
index fbd4068f8..d40faf54b 100644
--- a/test/e2e/commit_test.go
+++ b/test/e2e/commit_test.go
@@ -332,7 +332,7 @@ var _ = Describe("Podman commit", func() {
It("podman commit adds exposed ports", func() {
name := "testcon"
- s := podmanTest.Podman([]string{"run", "--name", name, "-p", "8080:80", ALPINE, "true"})
+ s := podmanTest.Podman([]string{"run", "--name", name, "-p", "8585:80", ALPINE, "true"})
s.WaitWithDefaultTimeout()
Expect(s).Should(Exit(0))
diff --git a/test/e2e/common_test.go b/test/e2e/common_test.go
index 20ed72c59..7228682f3 100644
--- a/test/e2e/common_test.go
+++ b/test/e2e/common_test.go
@@ -311,7 +311,7 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
func (p PodmanTestIntegration) AddImageToRWStore(image string) {
if err := p.RestoreArtifact(image); err != nil {
- logrus.Errorf("unable to restore %s to RW store", image)
+ logrus.Errorf("Unable to restore %s to RW store", image)
}
}
diff --git a/test/e2e/config/containers.conf b/test/e2e/config/containers.conf
index bbd712254..c33f32ab4 100644
--- a/test/e2e/config/containers.conf
+++ b/test/e2e/config/containers.conf
@@ -59,6 +59,7 @@ no_hosts=true
[engine]
network_cmd_options=["allow_host_loopback=true"]
+service_timeout=1234
# We need to ensure each test runs on a separate plugin instance...
# For now, let's just make a bunch of plugin paths and have each test use one.
diff --git a/test/e2e/container_inspect_test.go b/test/e2e/container_inspect_test.go
index 7d05b09fb..597eeb1a4 100644
--- a/test/e2e/container_inspect_test.go
+++ b/test/e2e/container_inspect_test.go
@@ -47,25 +47,25 @@ var _ = Describe("Podman container inspect", func() {
It("podman inspect shows exposed ports", func() {
name := "testcon"
- session := podmanTest.Podman([]string{"run", "-d", "--stop-timeout", "0", "--expose", "8080/udp", "--name", name, ALPINE, "sleep", "inf"})
+ session := podmanTest.Podman([]string{"run", "-d", "--stop-timeout", "0", "--expose", "8787/udp", "--name", name, ALPINE, "sleep", "inf"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
data := podmanTest.InspectContainer(name)
Expect(data).To(HaveLen(1))
Expect(data[0].NetworkSettings.Ports).
- To(Equal(map[string][]define.InspectHostPort{"8080/udp": nil}))
+ To(Equal(map[string][]define.InspectHostPort{"8787/udp": nil}))
})
It("podman inspect shows exposed ports on image", func() {
name := "testcon"
- session := podmanTest.Podman([]string{"run", "-d", "--expose", "8080", "--name", name, nginx})
+ session := podmanTest.Podman([]string{"run", "-d", "--expose", "8989", "--name", name, nginx})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
data := podmanTest.InspectContainer(name)
Expect(data).To(HaveLen(1))
Expect(data[0].NetworkSettings.Ports).
- To(Equal(map[string][]define.InspectHostPort{"80/tcp": nil, "8080/tcp": nil}))
+ To(Equal(map[string][]define.InspectHostPort{"80/tcp": nil, "8989/tcp": nil}))
})
})
diff --git a/test/e2e/containers_conf_test.go b/test/e2e/containers_conf_test.go
index f5e85e723..fac200c3c 100644
--- a/test/e2e/containers_conf_test.go
+++ b/test/e2e/containers_conf_test.go
@@ -444,4 +444,12 @@ var _ = Describe("Podman run", func() {
Expect(session).Should(Exit(0))
Expect(session.ErrorToString()).To(ContainSubstring("invalid image_copy_tmp_dir"))
})
+
+ It("podman system sevice --help shows (default 20)", func() {
+ SkipIfRemote("this test is only for local")
+ result := podmanTest.Podman([]string{"system", "service", "--help"})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+ Expect(result.OutputToString()).To(ContainSubstring("(default 1234)"))
+ })
})
diff --git a/test/e2e/create_test.go b/test/e2e/create_test.go
index 32d98c2a9..d20dc8874 100644
--- a/test/e2e/create_test.go
+++ b/test/e2e/create_test.go
@@ -618,7 +618,7 @@ var _ = Describe("Podman create", func() {
pod.WaitWithDefaultTimeout()
Expect(pod).Should(Exit(0))
- session := podmanTest.Podman([]string{"create", "--pod", name, "-p", "8080:80", ALPINE, "top"})
+ session := podmanTest.Podman([]string{"create", "--pod", name, "-p", "8086:80", ALPINE, "top"})
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitWithError())
})
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index bf89a0708..cb987e139 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -6,6 +6,8 @@ import (
"path/filepath"
"strconv"
+ "github.com/containers/podman/v3/libpod/define"
+
"github.com/containers/podman/v3/pkg/util"
. "github.com/containers/podman/v3/test/utils"
"github.com/ghodss/yaml"
@@ -555,6 +557,15 @@ var _ = Describe("Podman generate kube", func() {
kube.WaitWithDefaultTimeout()
Expect(kube).Should(Exit(0))
+ b, err := ioutil.ReadFile(outputFile)
+ Expect(err).ShouldNot(HaveOccurred())
+ pod := new(v1.Pod)
+ err = yaml.Unmarshal(b, pod)
+ Expect(err).To(BeNil())
+ val, found := pod.Annotations[define.BindMountPrefix+vol1]
+ Expect(found).To(BeTrue())
+ Expect(val).To(HaveSuffix("z"))
+
rm := podmanTest.Podman([]string{"pod", "rm", "-f", "test1"})
rm.WaitWithDefaultTimeout()
Expect(rm).Should(Exit(0))
@@ -792,6 +803,45 @@ var _ = Describe("Podman generate kube", func() {
Expect(containers[0].Args).To(Equal([]string{"10s"}))
})
+ It("podman generate kube - no command", func() {
+ session := podmanTest.Podman([]string{"create", "--name", "test", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ kube := podmanTest.Podman([]string{"generate", "kube", "test"})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ // Now make sure that the container's command is not set to the
+ // entrypoint and it's arguments to "10s".
+ pod := new(v1.Pod)
+ err := yaml.Unmarshal(kube.Out.Contents(), pod)
+ Expect(err).To(BeNil())
+
+ containers := pod.Spec.Containers
+ Expect(len(containers)).To(Equal(1))
+ Expect(len(containers[0].Command)).To(Equal(0))
+
+ cmd := []string{"echo", "hi"}
+ session = podmanTest.Podman(append([]string{"create", "--name", "test1", ALPINE}, cmd...))
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ kube = podmanTest.Podman([]string{"generate", "kube", "test1"})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ // Now make sure that the container's command is not set to the
+ // entrypoint and it's arguments to "10s".
+ pod = new(v1.Pod)
+ err = yaml.Unmarshal(kube.Out.Contents(), pod)
+ Expect(err).To(BeNil())
+
+ containers = pod.Spec.Containers
+ Expect(len(containers)).To(Equal(1))
+ Expect(containers[0].Command).To(Equal(cmd))
+ })
+
It("podman generate kube - use entrypoint from image", func() {
// Build an image with an entrypoint.
containerfile := `FROM quay.io/libpod/alpine:latest
diff --git a/test/e2e/healthcheck_run_test.go b/test/e2e/healthcheck_run_test.go
index 87f042ed9..b2666c789 100644
--- a/test/e2e/healthcheck_run_test.go
+++ b/test/e2e/healthcheck_run_test.go
@@ -80,6 +80,11 @@ var _ = Describe("Podman healthcheck run", func() {
time.Sleep(1 * time.Second)
}
Expect(exitCode).To(Equal(0))
+
+ ps := podmanTest.Podman([]string{"ps"})
+ ps.WaitWithDefaultTimeout()
+ Expect(ps).Should(Exit(0))
+ Expect(ps.OutputToString()).To(ContainSubstring("(healthy)"))
})
It("podman healthcheck that should fail", func() {
@@ -117,7 +122,7 @@ var _ = Describe("Podman healthcheck run", func() {
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
inspect := podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Healthcheck.Status).To(Equal("starting"))
+ Expect(inspect[0].State.Health.Status).To(Equal("starting"))
})
It("podman healthcheck failed checks in start-period should not change status", func() {
@@ -138,7 +143,9 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(1))
inspect := podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Healthcheck.Status).To(Equal("starting"))
+ Expect(inspect[0].State.Health.Status).To(Equal("starting"))
+ // test old podman compat (see #11645)
+ Expect(inspect[0].State.Healthcheck().Status).To(Equal("starting"))
})
It("podman healthcheck failed checks must reach retries before unhealthy ", func() {
@@ -151,15 +158,16 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(1))
inspect := podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Healthcheck.Status).To(Equal("starting"))
+ Expect(inspect[0].State.Health.Status).To(Equal("starting"))
hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
Expect(hc).Should(Exit(1))
inspect = podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Healthcheck.Status).To(Equal(define.HealthCheckUnhealthy))
-
+ Expect(inspect[0].State.Health.Status).To(Equal(define.HealthCheckUnhealthy))
+ // test old podman compat (see #11645)
+ Expect(inspect[0].State.Healthcheck().Status).To(Equal(define.HealthCheckUnhealthy))
})
It("podman healthcheck good check results in healthy even in start-period", func() {
@@ -172,7 +180,7 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(0))
inspect := podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Healthcheck.Status).To(Equal(define.HealthCheckHealthy))
+ Expect(inspect[0].State.Health.Status).To(Equal(define.HealthCheckHealthy))
})
It("podman healthcheck unhealthy but valid arguments check", func() {
@@ -195,14 +203,14 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(1))
inspect := podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Healthcheck.Status).To(Equal("starting"))
+ Expect(inspect[0].State.Health.Status).To(Equal("starting"))
hc = podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
Expect(hc).Should(Exit(1))
inspect = podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Healthcheck.Status).To(Equal(define.HealthCheckUnhealthy))
+ Expect(inspect[0].State.Health.Status).To(Equal(define.HealthCheckUnhealthy))
foo := podmanTest.Podman([]string{"exec", "hc", "touch", "/foo"})
foo.WaitWithDefaultTimeout()
@@ -213,6 +221,13 @@ var _ = Describe("Podman healthcheck run", func() {
Expect(hc).Should(Exit(0))
inspect = podmanTest.InspectContainer("hc")
- Expect(inspect[0].State.Healthcheck.Status).To(Equal(define.HealthCheckHealthy))
+ Expect(inspect[0].State.Health.Status).To(Equal(define.HealthCheckHealthy))
+
+ // Test podman ps --filter heath is working (#11687)
+ ps := podmanTest.Podman([]string{"ps", "--filter", "health=healthy"})
+ ps.WaitWithDefaultTimeout()
+ Expect(ps).Should(Exit(0))
+ Expect(len(ps.OutputToStringArray())).To(Equal(2))
+ Expect(ps.OutputToString()).To(ContainSubstring("hc"))
})
})
diff --git a/test/e2e/inspect_test.go b/test/e2e/inspect_test.go
index 12165d92d..63a54a5ca 100644
--- a/test/e2e/inspect_test.go
+++ b/test/e2e/inspect_test.go
@@ -451,14 +451,14 @@ var _ = Describe("Podman inspect", func() {
It("podman inspect --format json .NetworkSettings.Ports", func() {
ctnrName := "Ctnr_" + RandomString(25)
- create := podmanTest.Podman([]string{"create", "--name", ctnrName, "-p", "8080:80", ALPINE})
+ create := podmanTest.Podman([]string{"create", "--name", ctnrName, "-p", "8084:80", ALPINE})
create.WaitWithDefaultTimeout()
Expect(create).Should(Exit(0))
inspect := podmanTest.Podman([]string{"inspect", `--format="{{json .NetworkSettings.Ports}}"`, ctnrName})
inspect.WaitWithDefaultTimeout()
Expect(inspect).Should(Exit(0))
- Expect(inspect.OutputToString()).To(Equal(`"{"80/tcp":[{"HostIp":"","HostPort":"8080"}]}"`))
+ Expect(inspect.OutputToString()).To(Equal(`"{"80/tcp":[{"HostIp":"","HostPort":"8084"}]}"`))
})
It("Verify container inspect has default network", func() {
diff --git a/test/e2e/network_connect_disconnect_test.go b/test/e2e/network_connect_disconnect_test.go
index 217efdeec..5f7c55d3f 100644
--- a/test/e2e/network_connect_disconnect_test.go
+++ b/test/e2e/network_connect_disconnect_test.go
@@ -52,7 +52,6 @@ var _ = Describe("Podman network connect and disconnect", func() {
})
It("network disconnect with net mode slirp4netns should result in error", func() {
- SkipIfRootless("network connect and disconnect are only rootful")
netName := "slirp" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
@@ -118,7 +117,6 @@ var _ = Describe("Podman network connect and disconnect", func() {
})
It("network connect with net mode slirp4netns should result in error", func() {
- SkipIfRootless("network connect and disconnect are only rootful")
netName := "slirp" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
@@ -146,6 +144,13 @@ var _ = Describe("Podman network connect and disconnect", func() {
ctr := podmanTest.Podman([]string{"create", "--name", "test", "--network", netName, ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
Expect(ctr).Should(Exit(0))
+ cid := ctr.OutputToString()
+
+ // network alias container short id is always added and shown in inspect
+ inspect := podmanTest.Podman([]string{"container", "inspect", "test", "--format", "{{(index .NetworkSettings.Networks \"" + netName + "\").Aliases}}"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).Should(Exit(0))
+ Expect(inspect.OutputToString()).To(Equal("[" + cid[0:12] + "]"))
con := podmanTest.Podman([]string{"network", "connect", netName, "test"})
con.WaitWithDefaultTimeout()
@@ -153,7 +158,6 @@ var _ = Describe("Podman network connect and disconnect", func() {
})
It("podman network connect", func() {
- SkipIfRemote("This requires a pending PR to be merged before it will work")
netName := "aliasTest" + stringid.GenerateNonCryptoID()
session := podmanTest.Podman([]string{"network", "create", netName})
session.WaitWithDefaultTimeout()
@@ -163,6 +167,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
ctr := podmanTest.Podman([]string{"run", "-dt", "--name", "test", "--network", netName, ALPINE, "top"})
ctr.WaitWithDefaultTimeout()
Expect(ctr).Should(Exit(0))
+ cid := ctr.OutputToString()
exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout()
@@ -184,6 +189,12 @@ var _ = Describe("Podman network connect and disconnect", func() {
Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal("2"))
+ // network alias container short id is always added and shown in inspect
+ inspect = podmanTest.Podman([]string{"container", "inspect", "test", "--format", "{{(index .NetworkSettings.Networks \"" + newNetName + "\").Aliases}}"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).Should(Exit(0))
+ Expect(inspect.OutputToString()).To(Equal("[" + cid[0:12] + "]"))
+
exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth1"})
exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0))
@@ -193,7 +204,6 @@ var _ = Describe("Podman network connect and disconnect", func() {
rm.WaitWithDefaultTimeout()
Expect(rm).Should(Exit(0))
Expect(rm.ErrorToString()).To(Equal(""))
-
})
It("podman network connect when not running", func() {
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index 7e56b8a25..8e47fac75 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -603,6 +603,11 @@ var _ = Describe("Podman network", func() {
})
It("podman network prune --filter", func() {
+ // set custom cni directory to prevent flakes
+ podmanTest.CNIConfigDir = tempdir
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
net1 := "macvlan" + stringid.GenerateNonCryptoID() + "net1"
nc := podmanTest.Podman([]string{"network", "create", net1})
@@ -613,11 +618,10 @@ var _ = Describe("Podman network", func() {
list := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
list.WaitWithDefaultTimeout()
Expect(list).Should(Exit(0))
+ Expect(list.OutputToStringArray()).Should(HaveLen(2))
- Expect(StringInSlice(net1, list.OutputToStringArray())).To(BeTrue())
- if !isRootless() {
- Expect(StringInSlice("podman", list.OutputToStringArray())).To(BeTrue())
- }
+ Expect(list.OutputToStringArray()).Should(ContainElement(net1))
+ Expect(list.OutputToStringArray()).Should(ContainElement("podman"))
// -f needed only to skip y/n question
prune := podmanTest.Podman([]string{"network", "prune", "-f", "--filter", "until=50"})
@@ -627,11 +631,10 @@ var _ = Describe("Podman network", func() {
listAgain := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
listAgain.WaitWithDefaultTimeout()
Expect(listAgain).Should(Exit(0))
+ Expect(listAgain.OutputToStringArray()).Should(HaveLen(2))
- Expect(StringInSlice(net1, listAgain.OutputToStringArray())).To(BeTrue())
- if !isRootless() {
- Expect(StringInSlice("podman", list.OutputToStringArray())).To(BeTrue())
- }
+ Expect(listAgain.OutputToStringArray()).Should(ContainElement(net1))
+ Expect(listAgain.OutputToStringArray()).Should(ContainElement("podman"))
// -f needed only to skip y/n question
prune = podmanTest.Podman([]string{"network", "prune", "-f", "--filter", "until=5000000000000"})
@@ -641,14 +644,18 @@ var _ = Describe("Podman network", func() {
listAgain = podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
listAgain.WaitWithDefaultTimeout()
Expect(listAgain).Should(Exit(0))
+ Expect(listAgain.OutputToStringArray()).Should(HaveLen(1))
- Expect(StringInSlice(net1, listAgain.OutputToStringArray())).To(BeFalse())
- if !isRootless() {
- Expect(StringInSlice("podman", list.OutputToStringArray())).To(BeTrue())
- }
+ Expect(listAgain.OutputToStringArray()).ShouldNot(ContainElement(net1))
+ Expect(listAgain.OutputToStringArray()).Should(ContainElement("podman"))
})
It("podman network prune", func() {
+ // set custom cni directory to prevent flakes
+ podmanTest.CNIConfigDir = tempdir
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
// Create two networks
// Check they are there
// Run a container on one of them
@@ -669,13 +676,11 @@ var _ = Describe("Podman network", func() {
list := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
list.WaitWithDefaultTimeout()
- Expect(list).Should(Exit(0))
+ Expect(list.OutputToStringArray()).Should(HaveLen(3))
- Expect(StringInSlice(net1, list.OutputToStringArray())).To(BeTrue())
- Expect(StringInSlice(net2, list.OutputToStringArray())).To(BeTrue())
- if !isRootless() {
- Expect(StringInSlice("podman", list.OutputToStringArray())).To(BeTrue())
- }
+ Expect(list.OutputToStringArray()).Should(ContainElement(net1))
+ Expect(list.OutputToStringArray()).Should(ContainElement(net2))
+ Expect(list.OutputToStringArray()).Should(ContainElement("podman"))
session := podmanTest.Podman([]string{"run", "-dt", "--net", net2, ALPINE, "top"})
session.WaitWithDefaultTimeout()
@@ -688,13 +693,10 @@ var _ = Describe("Podman network", func() {
listAgain := podmanTest.Podman([]string{"network", "ls", "--format", "{{.Name}}"})
listAgain.WaitWithDefaultTimeout()
Expect(listAgain).Should(Exit(0))
+ Expect(listAgain.OutputToStringArray()).Should(HaveLen(2))
- Expect(StringInSlice(net1, listAgain.OutputToStringArray())).To(BeFalse())
- Expect(StringInSlice(net2, listAgain.OutputToStringArray())).To(BeTrue())
- // Make sure default network 'podman' still exists
- if !isRootless() {
- Expect(StringInSlice("podman", list.OutputToStringArray())).To(BeTrue())
- }
-
+ Expect(listAgain.OutputToStringArray()).ShouldNot(ContainElement(net1))
+ Expect(listAgain.OutputToStringArray()).Should(ContainElement(net2))
+ Expect(listAgain.OutputToStringArray()).Should(ContainElement("podman"))
})
})
diff --git a/test/e2e/play_build_test.go b/test/e2e/play_build_test.go
index 16f2687f3..564735e07 100644
--- a/test/e2e/play_build_test.go
+++ b/test/e2e/play_build_test.go
@@ -80,12 +80,17 @@ status: {}
FROM quay.io/libpod/alpine_nginx:latest
RUN apk update && apk add strace
LABEL homer=dad
+COPY copyfile /copyfile
`
var prebuiltImage = `
FROM quay.io/libpod/alpine_nginx:latest
RUN apk update && apk add strace
LABEL marge=mom
`
+
+ var copyFile = `just a text file
+`
+
It("Check that image is built using Dockerfile", func() {
// Setup
yamlDir := filepath.Join(tempdir, RandomString(12))
@@ -97,7 +102,9 @@ LABEL marge=mom
Expect(err).To(BeNil())
err = writeYaml(playBuildFile, filepath.Join(app1Dir, "Dockerfile"))
Expect(err).To(BeNil())
-
+ // Write a file to be copied
+ err = writeYaml(copyFile, filepath.Join(app1Dir, "copyfile"))
+ Expect(err).To(BeNil())
// Switch to temp dir and restore it afterwards
cwd, err := os.Getwd()
Expect(err).To(BeNil())
@@ -131,7 +138,9 @@ LABEL marge=mom
Expect(err).To(BeNil())
err = writeYaml(playBuildFile, filepath.Join(app1Dir, "Containerfile"))
Expect(err).To(BeNil())
-
+ // Write a file to be copied
+ err = writeYaml(copyFile, filepath.Join(app1Dir, "copyfile"))
+ Expect(err).To(BeNil())
// Switch to temp dir and restore it afterwards
cwd, err := os.Getwd()
Expect(err).To(BeNil())
@@ -172,6 +181,9 @@ LABEL marge=mom
Expect(err).To(BeNil())
err = writeYaml(playBuildFile, filepath.Join(app1Dir, "Containerfile"))
Expect(err).To(BeNil())
+ // Write a file to be copied
+ err = writeYaml(copyFile, filepath.Join(app1Dir, "copyfile"))
+ Expect(err).To(BeNil())
// Switch to temp dir and restore it afterwards
cwd, err := os.Getwd()
@@ -215,6 +227,9 @@ LABEL marge=mom
Expect(err).To(BeNil())
err = writeYaml(playBuildFile, filepath.Join(app1Dir, "Containerfile"))
Expect(err).To(BeNil())
+ // Write a file to be copied
+ err = writeYaml(copyFile, filepath.Join(app1Dir, "copyfile"))
+ Expect(err).To(BeNil())
// Switch to temp dir and restore it afterwards
cwd, err := os.Getwd()
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index fcda89fbc..83ce751e6 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -63,12 +63,6 @@ spec:
- -d
- "1.5"
env:
- - name: PATH
- value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- - name: TERM
- value: xterm
- - name: container
- value: podman
- name: HOSTNAME
value: label-pod
image: quay.io/libpod/alpine:latest
@@ -171,12 +165,6 @@ spec:
- -d
- "1.5"
env:
- - name: PATH
- value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- - name: TERM
- value: xterm
- - name: container
- value: podman
- name: HOSTNAME
value: label-pod
image: quay.io/libpod/alpine:latest
@@ -287,13 +275,7 @@ spec:
- {{.}}
{{ end }}
env:
- - name: PATH
- value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- - name: TERM
- value: xterm
- name: HOSTNAME
- - name: container
- value: podman
{{ range .Env }}
- name: {{ .Name }}
{{ if (eq .ValueFrom "configmap") }}
@@ -453,13 +435,7 @@ spec:
- {{.}}
{{ end }}
env:
- - name: PATH
- value: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
- - name: TERM
- value: xterm
- name: HOSTNAME
- - name: container
- value: podman
image: {{ .Image }}
name: {{ .Name }}
imagePullPolicy: {{ .PullPolicy }}
@@ -2344,6 +2320,39 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
}
})
+ It("podman play kube allows setting resource limits with --cpus 1", func() {
+ SkipIfContainerized("Resource limits require a running systemd")
+ SkipIfRootless("CPU limits require root")
+ podmanTest.CgroupManager = "systemd"
+
+ var (
+ expectedCpuLimit string = "1"
+ )
+
+ deployment := getDeployment(
+ withPod(getPod(withCtr(getCtr(
+ withCpuLimit(expectedCpuLimit),
+ )))))
+ err := generateKubeYaml("deployment", deployment, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ for _, pod := range getPodNamesInDeployment(deployment) {
+ inspect := podmanTest.Podman([]string{"inspect", getCtrNameInPod(&pod), "--format", `{{ .HostConfig.CpuPeriod }}:{{ .HostConfig.CpuQuota }}`})
+
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).Should(Exit(0))
+
+ parts := strings.Split(strings.Trim(inspect.OutputToString(), "\n"), ":")
+ Expect(parts).To(HaveLen(2))
+
+ Expect(parts[0]).To(Equal(parts[1]))
+ }
+ })
+
It("podman play kube reports invalid image name", func() {
invalidImageName := "./myimage"
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go
index 7d40d36dd..c9924be72 100644
--- a/test/e2e/pod_create_test.go
+++ b/test/e2e/pod_create_test.go
@@ -108,7 +108,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", "8080:80"})
+ session := podmanTest.Podman([]string{"pod", "create", "--name", name, "-p", "8081:80"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
pod := session.OutputToString()
@@ -117,14 +117,14 @@ var _ = Describe("Podman pod create", func() {
webserver.WaitWithDefaultTimeout()
Expect(webserver).Should(Exit(0))
- check := SystemExec("nc", []string{"-z", "localhost", "8080"})
+ check := SystemExec("nc", []string{"-z", "localhost", "8081"})
Expect(check).Should(Exit(0))
})
It("podman create pod with id file with network portbindings", func() {
file := filepath.Join(podmanTest.TempDir, "pod.id")
name := "test"
- session := podmanTest.Podman([]string{"pod", "create", "--name", name, "--pod-id-file", file, "-p", "8080:80"})
+ session := podmanTest.Podman([]string{"pod", "create", "--name", name, "--pod-id-file", file, "-p", "8082:80"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
@@ -132,7 +132,7 @@ var _ = Describe("Podman pod create", func() {
webserver.WaitWithDefaultTimeout()
Expect(webserver).Should(Exit(0))
- check := SystemExec("nc", []string{"-z", "localhost", "8080"})
+ check := SystemExec("nc", []string{"-z", "localhost", "8082"})
Expect(check).Should(Exit(0))
})
@@ -881,6 +881,25 @@ ENTRYPOINT ["sleep","99999"]
ctr3 := podmanTest.Podman([]string{"run", "--pod", podName, ALPINE, "cat", "/tmp1/test"})
ctr3.WaitWithDefaultTimeout()
Expect(ctr3.OutputToString()).To(ContainSubstring("hello"))
+ })
+
+ It("podman pod create --device", func() {
+ SkipIfRootless("Cannot create devices in /dev in rootless mode")
+ Expect(os.MkdirAll("/dev/foodevdir", os.ModePerm)).To(BeNil())
+ defer os.RemoveAll("/dev/foodevdir")
+
+ mknod := SystemExec("mknod", []string{"/dev/foodevdir/null", "c", "1", "3"})
+ mknod.WaitWithDefaultTimeout()
+ Expect(mknod).Should(Exit(0))
+
+ podName := "testPod"
+ session := podmanTest.Podman([]string{"pod", "create", "--device", "/dev/foodevdir:/dev/bar", "--name", podName})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ session = podmanTest.Podman([]string{"run", "-q", "--pod", podName, ALPINE, "stat", "-c%t:%T", "/dev/bar/null"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).To(Equal("1:3"))
})
diff --git a/test/e2e/pod_inspect_test.go b/test/e2e/pod_inspect_test.go
index 6633b228c..5728cf9b9 100644
--- a/test/e2e/pod_inspect_test.go
+++ b/test/e2e/pod_inspect_test.go
@@ -85,7 +85,7 @@ var _ = Describe("Podman pod inspect", func() {
It("podman pod inspect outputs port bindings", func() {
podName := "testPod"
- create := podmanTest.Podman([]string{"pod", "create", "--name", podName, "-p", "8080:80"})
+ create := podmanTest.Podman([]string{"pod", "create", "--name", podName, "-p", "8383:80"})
create.WaitWithDefaultTimeout()
Expect(create).Should(Exit(0))
@@ -98,7 +98,7 @@ var _ = Describe("Podman pod inspect", func() {
Expect(err).To(BeNil())
Expect(inspectJSON.InfraConfig).To(Not(BeNil()))
Expect(len(inspectJSON.InfraConfig.PortBindings["80/tcp"])).To(Equal(1))
- Expect(inspectJSON.InfraConfig.PortBindings["80/tcp"][0].HostPort).To(Equal("8080"))
+ Expect(inspectJSON.InfraConfig.PortBindings["80/tcp"][0].HostPort).To(Equal("8383"))
})
It("podman pod inspect outputs show correct MAC", func() {
diff --git a/test/e2e/pod_start_test.go b/test/e2e/pod_start_test.go
index 93c200389..e895b5598 100644
--- a/test/e2e/pod_start_test.go
+++ b/test/e2e/pod_start_test.go
@@ -92,7 +92,7 @@ var _ = Describe("Podman pod start", func() {
pod, _, podid1 := podmanTest.CreatePod(map[string][]string{
"--infra": {"true"},
"--name": {podName[0]},
- "--publish": {"127.0.0.1:8080:80"},
+ "--publish": {"127.0.0.1:8083:80"},
})
Expect(pod).To(Exit(0))
@@ -103,7 +103,7 @@ var _ = Describe("Podman pod start", func() {
pod, _, podid2 := podmanTest.CreatePod(map[string][]string{
"--infra": {"true"},
"--name": {podName[1]},
- "--publish": {"127.0.0.1:8080:80"},
+ "--publish": {"127.0.0.1:8083:80"},
})
Expect(pod).To(Exit(0))
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index aeb88e481..881d9fcf0 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -6,7 +6,6 @@ import (
"regexp"
"sort"
"strconv"
- "strings"
. "github.com/containers/podman/v3/test/utils"
"github.com/containers/storage/pkg/stringid"
@@ -187,7 +186,10 @@ var _ = Describe("Podman ps", func() {
result.WaitWithDefaultTimeout()
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(result.OutputToString()).To(ContainSubstring("bravo"))
+
+ actual := result.OutputToString()
+ Expect(actual).To(ContainSubstring("bravo"))
+ Expect(actual).To(ContainSubstring("NAMES"))
})
It("podman ps --filter network=container:<id>", func() {
@@ -206,7 +208,9 @@ var _ = Describe("Podman ps", func() {
result.WaitWithDefaultTimeout()
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(result.OutputToString()).To(ContainSubstring("second"))
+ actual := result.OutputToString()
+ Expect(actual).To(ContainSubstring("second"))
+ Expect(actual).ToNot(ContainSubstring("table"))
})
It("podman ps namespace flag", func() {
@@ -228,7 +232,7 @@ var _ = Describe("Podman ps", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
// it must contains `::` when some ns is null. If it works normally, it should be "$num1:$num2:$num3"
- Expect(result.OutputToString()).To(Not(ContainSubstring(`::`)))
+ Expect(result.OutputToString()).ToNot(ContainSubstring(`::`))
})
It("podman ps with no containers is valid json format", func() {
@@ -285,11 +289,14 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "-a", "--format", "table {{.ID}} {{.Image}} {{.ImageID}} {{.Labels}}"})
result.WaitWithDefaultTimeout()
-
- Expect(result.OutputToStringArray()[0]).ToNot(ContainSubstring("table"))
- Expect(result.OutputToStringArray()[0]).ToNot(ContainSubstring("ImageID"))
- Expect(result.OutputToStringArray()[0]).To(ContainSubstring("alpine:latest"))
Expect(result).Should(Exit(0))
+
+ Expect(result.OutputToString()).ToNot(ContainSubstring("table"))
+
+ actual := result.OutputToStringArray()
+ Expect(actual[0]).To(ContainSubstring("CONTAINER ID"))
+ Expect(actual[0]).ToNot(ContainSubstring("ImageID"))
+ Expect(actual[1]).To(ContainSubstring("alpine:latest"))
})
It("podman ps ancestor filter flag", func() {
@@ -380,7 +387,9 @@ var _ = Describe("Podman ps", func() {
psFilter.WaitWithDefaultTimeout()
Expect(psFilter).Should(Exit(0))
- Expect(strings.Contains(psFilter.OutputToString(), ctrName)).To(BeFalse())
+ actual := psFilter.OutputToString()
+ Expect(actual).ToNot(ContainSubstring(ctrName))
+ Expect(actual).ToNot(ContainSubstring("NAMES"))
})
It("podman ps mutually exclusive flags", func() {
@@ -453,14 +462,13 @@ var _ = Describe("Podman ps", func() {
Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"ps", "-a", "--sort=command", "--format", "{{.Command}}"})
-
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- sortedArr := session.OutputToStringArray()
+ Expect(session.OutputToString()).ToNot(ContainSubstring("COMMAND"))
+ sortedArr := session.OutputToStringArray()
Expect(sort.SliceIsSorted(sortedArr, func(i, j int) bool { return sortedArr[i] < sortedArr[j] })).To(BeTrue())
-
})
It("podman --pod", func() {
@@ -474,7 +482,7 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "--no-trunc"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(session.OutputToString()).To(Not(ContainSubstring(podid)))
+ Expect(session.OutputToString()).ToNot(ContainSubstring(podid))
session = podmanTest.Podman([]string{"ps", "--pod", "--no-trunc"})
session.WaitWithDefaultTimeout()
@@ -510,7 +518,11 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "--format", "{{.Ports}}"})
session.WaitWithDefaultTimeout()
- Expect(session.OutputToString()).To(ContainSubstring("0.0.0.0:2000-2006"))
+ Expect(session).To(Exit(0))
+
+ actual := session.OutputToString()
+ Expect(actual).To(ContainSubstring("0.0.0.0:2000-2006"))
+ Expect(actual).ToNot(ContainSubstring("PORT"))
})
It("podman ps test with invalid port range", func() {
@@ -597,7 +609,7 @@ var _ = Describe("Podman ps", func() {
It("podman ps test with port shared with pod", func() {
podName := "testPod"
- pod := podmanTest.Podman([]string{"pod", "create", "-p", "8080:80", "--name", podName})
+ pod := podmanTest.Podman([]string{"pod", "create", "-p", "8085:80", "--name", podName})
pod.WaitWithDefaultTimeout()
Expect(pod).Should(Exit(0))
@@ -609,7 +621,7 @@ var _ = Describe("Podman ps", func() {
ps := podmanTest.Podman([]string{"ps", "--filter", fmt.Sprintf("name=%s", ctrName), "--format", "{{.Ports}}"})
ps.WaitWithDefaultTimeout()
Expect(ps).Should(Exit(0))
- Expect(ps.OutputToString()).To(ContainSubstring("0.0.0.0:8080->80/tcp"))
+ Expect(ps.OutputToString()).To(ContainSubstring("0.0.0.0:8085->80/tcp"))
})
It("podman ps truncate long create command", func() {
@@ -628,7 +640,10 @@ var _ = Describe("Podman ps", func() {
result := podmanTest.Podman([]string{"ps", "-a", "--format", "{{.RunningFor}}"})
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
- Expect(result.OutputToString()).To(ContainSubstring("ago"))
+
+ actual := result.OutputToString()
+ Expect(actual).To(ContainSubstring("ago"))
+ Expect(actual).ToNot(ContainSubstring("RUNNING FOR"))
})
It("podman ps filter test", func() {
@@ -823,8 +838,9 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "--all", "--no-trunc", "--filter", "network=" + net})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- Expect(session.OutputToString()).To(ContainSubstring(ctrWithNet))
- Expect(session.OutputToString()).To(Not(ContainSubstring(ctrWithoutNet)))
+ actual := session.OutputToString()
+ Expect(actual).To(ContainSubstring(ctrWithNet))
+ Expect(actual).ToNot(ContainSubstring(ctrWithoutNet))
})
It("podman ps --format networks", func() {
@@ -835,12 +851,15 @@ var _ = Describe("Podman ps", func() {
session = podmanTest.Podman([]string{"ps", "--all", "--format", "{{ .Networks }}"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
+
+ actual := session.OutputToString()
+ Expect(actual).ToNot(ContainSubstring("NETWORKS"))
if isRootless() {
// rootless container don't have a network by default
- Expect(session.OutputToString()).To(Equal(""))
+ Expect(actual).To(BeEmpty())
} else {
// default network name is podman
- Expect(session.OutputToString()).To(Equal("podman"))
+ Expect(actual).To(Equal("podman"))
}
net1 := stringid.GenerateNonCryptoID()
diff --git a/test/e2e/rename_test.go b/test/e2e/rename_test.go
index 0bd1792c9..e5e69c25c 100644
--- a/test/e2e/rename_test.go
+++ b/test/e2e/rename_test.go
@@ -111,4 +111,29 @@ var _ = Describe("podman rename", func() {
Expect(ps).Should(Exit(0))
Expect(ps.OutputToString()).To(ContainSubstring(newName))
})
+
+ It("Rename a container that is part of a pod", func() {
+ podName := "testPod"
+ infraName := "infra1"
+ pod := podmanTest.Podman([]string{"pod", "create", "--name", podName, "--infra-name", infraName})
+ pod.WaitWithDefaultTimeout()
+ Expect(pod).Should(Exit(0))
+
+ infraName2 := "infra2"
+ rename := podmanTest.Podman([]string{"rename", infraName, infraName2})
+ rename.WaitWithDefaultTimeout()
+ Expect(rename).Should(Exit(0))
+
+ remove := podmanTest.Podman([]string{"pod", "rm", "-f", podName})
+ remove.WaitWithDefaultTimeout()
+ Expect(remove).Should(Exit(0))
+
+ create := podmanTest.Podman([]string{"create", "--name", infraName2, ALPINE, "top"})
+ create.WaitWithDefaultTimeout()
+ Expect(create).Should(Exit(0))
+
+ create2 := podmanTest.Podman([]string{"create", "--name", infraName, ALPINE, "top"})
+ create2.WaitWithDefaultTimeout()
+ Expect(create2).Should(Exit(0))
+ })
})
diff --git a/test/e2e/run_networking_test.go b/test/e2e/run_networking_test.go
index c7ffdaf4c..84707732b 100644
--- a/test/e2e/run_networking_test.go
+++ b/test/e2e/run_networking_test.go
@@ -98,9 +98,9 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
})
- It("podman run -p 80-82 -p 8080:8080", func() {
+ It("podman run -p 80-82 -p 8090:8090", func() {
name := "testctr"
- session := podmanTest.Podman([]string{"create", "-t", "-p", "80-82", "-p", "8080:8080", "--name", name, ALPINE, "/bin/sh"})
+ session := podmanTest.Podman([]string{"create", "-t", "-p", "80-82", "-p", "8090:8090", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
Expect(len(inspectOut)).To(Equal(1))
@@ -114,14 +114,14 @@ var _ = Describe("Podman run networking", func() {
Expect(len(inspectOut[0].NetworkSettings.Ports["82/tcp"])).To(Equal(1))
Expect(inspectOut[0].NetworkSettings.Ports["82/tcp"][0].HostPort).To(Not(Equal("82")))
Expect(inspectOut[0].NetworkSettings.Ports["82/tcp"][0].HostIP).To(Equal(""))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8080/tcp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["8080/tcp"][0].HostPort).To(Equal("8080"))
- Expect(inspectOut[0].NetworkSettings.Ports["8080/tcp"][0].HostIP).To(Equal(""))
+ Expect(len(inspectOut[0].NetworkSettings.Ports["8090/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8090/tcp"][0].HostPort).To(Equal("8090"))
+ Expect(inspectOut[0].NetworkSettings.Ports["8090/tcp"][0].HostIP).To(Equal(""))
})
- It("podman run -p 80-81 -p 8080-8081", func() {
+ It("podman run -p 80-81 -p 8180-8181", func() {
name := "testctr"
- session := podmanTest.Podman([]string{"create", "-t", "-p", "80-81", "-p", "8080-8081", "--name", name, ALPINE, "/bin/sh"})
+ session := podmanTest.Podman([]string{"create", "-t", "-p", "80-81", "-p", "8180-8181", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
Expect(len(inspectOut)).To(Equal(1))
@@ -132,17 +132,17 @@ var _ = Describe("Podman run networking", func() {
Expect(len(inspectOut[0].NetworkSettings.Ports["81/tcp"])).To(Equal(1))
Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0].HostPort).To(Not(Equal("81")))
Expect(inspectOut[0].NetworkSettings.Ports["81/tcp"][0].HostIP).To(Equal(""))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8080/tcp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["8080/tcp"][0].HostPort).To(Not(Equal("8080")))
- Expect(inspectOut[0].NetworkSettings.Ports["8080/tcp"][0].HostIP).To(Equal(""))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8081/tcp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["8081/tcp"][0].HostPort).To(Not(Equal("8081")))
- Expect(inspectOut[0].NetworkSettings.Ports["8081/tcp"][0].HostIP).To(Equal(""))
+ Expect(len(inspectOut[0].NetworkSettings.Ports["8180/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8180/tcp"][0].HostPort).To(Not(Equal("8180")))
+ Expect(inspectOut[0].NetworkSettings.Ports["8180/tcp"][0].HostIP).To(Equal(""))
+ Expect(len(inspectOut[0].NetworkSettings.Ports["8181/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostPort).To(Not(Equal("8181")))
+ Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostIP).To(Equal(""))
})
- It("podman run -p 80 -p 8080-8082:8080-8082", func() {
+ It("podman run -p 80 -p 8280-8282:8280-8282", func() {
name := "testctr"
- session := podmanTest.Podman([]string{"create", "-t", "-p", "80", "-p", "8080-8082:8080-8082", "--name", name, ALPINE, "/bin/sh"})
+ session := podmanTest.Podman([]string{"create", "-t", "-p", "80", "-p", "8280-8282:8280-8282", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
Expect(len(inspectOut)).To(Equal(1))
@@ -150,40 +150,40 @@ var _ = Describe("Podman run networking", func() {
Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Not(Equal("80")))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8080/tcp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["8080/tcp"][0].HostPort).To(Equal("8080"))
- Expect(inspectOut[0].NetworkSettings.Ports["8080/tcp"][0].HostIP).To(Equal(""))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8081/tcp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["8081/tcp"][0].HostPort).To(Equal("8081"))
- Expect(inspectOut[0].NetworkSettings.Ports["8081/tcp"][0].HostIP).To(Equal(""))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8082/tcp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["8082/tcp"][0].HostPort).To(Equal("8082"))
- Expect(inspectOut[0].NetworkSettings.Ports["8082/tcp"][0].HostIP).To(Equal(""))
- })
-
- It("podman run -p 8080:80", func() {
+ Expect(len(inspectOut[0].NetworkSettings.Ports["8280/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8280/tcp"][0].HostPort).To(Equal("8280"))
+ Expect(inspectOut[0].NetworkSettings.Ports["8280/tcp"][0].HostIP).To(Equal(""))
+ Expect(len(inspectOut[0].NetworkSettings.Ports["8281/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8281/tcp"][0].HostPort).To(Equal("8281"))
+ Expect(inspectOut[0].NetworkSettings.Ports["8281/tcp"][0].HostIP).To(Equal(""))
+ Expect(len(inspectOut[0].NetworkSettings.Ports["8282/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8282/tcp"][0].HostPort).To(Equal("8282"))
+ Expect(inspectOut[0].NetworkSettings.Ports["8282/tcp"][0].HostIP).To(Equal(""))
+ })
+
+ It("podman run -p 8380:80", func() {
name := "testctr"
- session := podmanTest.Podman([]string{"create", "-t", "-p", "8080:80", "--name", name, ALPINE, "/bin/sh"})
+ session := podmanTest.Podman([]string{"create", "-t", "-p", "8380:80", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
Expect(len(inspectOut)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8080"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8380"))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
})
- It("podman run -p 8080:80/TCP", func() {
+ It("podman run -p 8480:80/TCP", func() {
name := "testctr"
// "TCP" in upper characters
- session := podmanTest.Podman([]string{"create", "-t", "-p", "8080:80/TCP", "--name", name, ALPINE, "/bin/sh"})
+ session := podmanTest.Podman([]string{"create", "-t", "-p", "8480:80/TCP", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
Expect(len(inspectOut)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
// "tcp" in lower characters
Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8080"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8480"))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
})
@@ -199,51 +199,51 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal(""))
})
- It("podman run -p 127.0.0.1:8080:80", func() {
+ It("podman run -p 127.0.0.1:8580:80", func() {
name := "testctr"
- session := podmanTest.Podman([]string{"create", "-t", "-p", "127.0.0.1:8080:80", "--name", name, ALPINE, "/bin/sh"})
+ session := podmanTest.Podman([]string{"create", "-t", "-p", "127.0.0.1:8580:80", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
Expect(len(inspectOut)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8080"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8580"))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("127.0.0.1"))
})
- It("podman run -p 127.0.0.1:8080:80/udp", func() {
+ It("podman run -p 127.0.0.1:8680:80/udp", func() {
name := "testctr"
- session := podmanTest.Podman([]string{"create", "-t", "-p", "127.0.0.1:8080:80/udp", "--name", name, ALPINE, "/bin/sh"})
+ session := podmanTest.Podman([]string{"create", "-t", "-p", "127.0.0.1:8680:80/udp", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
Expect(len(inspectOut)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports["80/udp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Equal("8080"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Equal("8680"))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal("127.0.0.1"))
})
- It("podman run -p [::1]:8080:80/udp", func() {
+ It("podman run -p [::1]:8780:80/udp", func() {
name := "testctr"
- session := podmanTest.Podman([]string{"create", "-t", "-p", "[::1]:8080:80/udp", "--name", name, ALPINE, "/bin/sh"})
+ session := podmanTest.Podman([]string{"create", "-t", "-p", "[::1]:8780:80/udp", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
Expect(len(inspectOut)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports["80/udp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Equal("8080"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostPort).To(Equal("8780"))
Expect(inspectOut[0].NetworkSettings.Ports["80/udp"][0].HostIP).To(Equal("::1"))
})
- It("podman run -p [::1]:8080:80/tcp", func() {
+ It("podman run -p [::1]:8880:80/tcp", func() {
name := "testctr"
- session := podmanTest.Podman([]string{"create", "-t", "-p", "[::1]:8080:80/tcp", "--name", name, ALPINE, "/bin/sh"})
+ session := podmanTest.Podman([]string{"create", "-t", "-p", "[::1]:8880:80/tcp", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
Expect(len(inspectOut)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8080"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8880"))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal("::1"))
})
@@ -283,33 +283,33 @@ var _ = Describe("Podman run networking", func() {
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
})
- It("podman run -p 127.0.0.1::8080/udp", func() {
+ It("podman run -p 127.0.0.1::8980/udp", func() {
name := "testctr"
- session := podmanTest.Podman([]string{"create", "-t", "-p", "127.0.0.1::8080/udp", "--name", name, ALPINE, "/bin/sh"})
+ session := podmanTest.Podman([]string{"create", "-t", "-p", "127.0.0.1::8980/udp", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
Expect(len(inspectOut)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8080/udp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["8080/udp"][0].HostPort).To(Not(Equal("8080")))
- Expect(inspectOut[0].NetworkSettings.Ports["8080/udp"][0].HostIP).To(Equal("127.0.0.1"))
+ Expect(len(inspectOut[0].NetworkSettings.Ports["8980/udp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8980/udp"][0].HostPort).To(Not(Equal("8980")))
+ Expect(inspectOut[0].NetworkSettings.Ports["8980/udp"][0].HostIP).To(Equal("127.0.0.1"))
})
- It("podman run -p :8080", func() {
+ It("podman run -p :8181", func() {
name := "testctr"
- session := podmanTest.Podman([]string{"create", "-t", "-p", ":8080", "--name", name, ALPINE, "/bin/sh"})
+ session := podmanTest.Podman([]string{"create", "-t", "-p", ":8181", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
Expect(len(inspectOut)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
- Expect(len(inspectOut[0].NetworkSettings.Ports["8080/tcp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["8080/tcp"][0].HostPort).To(Not(Equal("8080")))
- Expect(inspectOut[0].NetworkSettings.Ports["8080/tcp"][0].HostIP).To(Equal(""))
+ Expect(len(inspectOut[0].NetworkSettings.Ports["8181/tcp"])).To(Equal(1))
+ Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostPort).To(Not(Equal("8181")))
+ Expect(inspectOut[0].NetworkSettings.Ports["8181/tcp"][0].HostIP).To(Equal(""))
})
- It("podman run -p 8080:8080 -p 8081:8080", func() {
+ It("podman run -p xxx:8080 -p yyy:8080", func() {
name := "testctr"
- session := podmanTest.Podman([]string{"create", "-t", "-p", "4000:8080", "-p", "8000:8080", "--name", name, ALPINE, "/bin/sh"})
+ session := podmanTest.Podman([]string{"create", "-t", "-p", "4444:8080", "-p", "5555:8080", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
Expect(len(inspectOut)).To(Equal(1))
@@ -320,18 +320,18 @@ var _ = Describe("Podman run networking", func() {
hp2 := inspectOut[0].NetworkSettings.Ports["8080/tcp"][1].HostPort
// We can't guarantee order
- Expect((hp1 == "4000" && hp2 == "8000") || (hp1 == "8000" && hp2 == "4000")).To(BeTrue())
+ Expect((hp1 == "4444" && hp2 == "5555") || (hp1 == "5555" && hp2 == "4444")).To(BeTrue())
})
- It("podman run -p 0.0.0.0:8080:80", func() {
+ It("podman run -p 0.0.0.0:9280:80", func() {
name := "testctr"
- session := podmanTest.Podman([]string{"create", "-t", "-p", "0.0.0.0:8080:80", "--name", name, ALPINE, "/bin/sh"})
+ session := podmanTest.Podman([]string{"create", "-t", "-p", "0.0.0.0:9280:80", "--name", name, ALPINE, "/bin/sh"})
session.WaitWithDefaultTimeout()
inspectOut := podmanTest.InspectContainer(name)
Expect(len(inspectOut)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports)).To(Equal(1))
Expect(len(inspectOut[0].NetworkSettings.Ports["80/tcp"])).To(Equal(1))
- Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("8080"))
+ Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostPort).To(Equal("9280"))
Expect(inspectOut[0].NetworkSettings.Ports["80/tcp"][0].HostIP).To(Equal(""))
})
@@ -348,20 +348,20 @@ var _ = Describe("Podman run networking", func() {
Expect(ncBusy).To(ExitWithError())
})
- It("podman run network expose host port 8081 to container port 8000 using rootlesskit port handler", func() {
- session := podmanTest.Podman([]string{"run", "--network", "slirp4netns:port_handler=rootlesskit", "-dt", "-p", "8081:8000", ALPINE, "/bin/sh"})
+ It("podman run network expose host port 18081 to container port 8000 using rootlesskit port handler", func() {
+ session := podmanTest.Podman([]string{"run", "--network", "slirp4netns:port_handler=rootlesskit", "-dt", "-p", "18081:8000", ALPINE, "/bin/sh"})
session.Wait(30)
Expect(session).Should(Exit(0))
- ncBusy := SystemExec("nc", []string{"-l", "-p", "8081"})
+ ncBusy := SystemExec("nc", []string{"-l", "-p", "18081"})
Expect(ncBusy).To(ExitWithError())
})
- It("podman run network expose host port 8082 to container port 8000 using slirp4netns port handler", func() {
- session := podmanTest.Podman([]string{"run", "--network", "slirp4netns:port_handler=slirp4netns", "-dt", "-p", "8082:8000", ALPINE, "/bin/sh"})
+ It("podman run network expose host port 18082 to container port 8000 using slirp4netns port handler", func() {
+ session := podmanTest.Podman([]string{"run", "--network", "slirp4netns:port_handler=slirp4netns", "-dt", "-p", "18082:8000", ALPINE, "/bin/sh"})
session.Wait(30)
Expect(session).Should(Exit(0))
- ncBusy := SystemExec("nc", []string{"-l", "-p", "8082"})
+ ncBusy := SystemExec("nc", []string{"-l", "-p", "18082"})
Expect(ncBusy).To(ExitWithError())
})
@@ -650,13 +650,13 @@ var _ = Describe("Podman run networking", func() {
defer podmanTest.removeCNINetwork(netName)
name := "nc-server"
- run := podmanTest.Podman([]string{"run", "--log-driver", "k8s-file", "-d", "--name", name, "--net", netName, ALPINE, "nc", "-l", "-p", "8080"})
+ run := podmanTest.Podman([]string{"run", "--log-driver", "k8s-file", "-d", "--name", name, "--net", netName, ALPINE, "nc", "-l", "-p", "9480"})
run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0))
// NOTE: we force the k8s-file log driver to make sure the
// tests are passing inside a container.
- run = podmanTest.Podman([]string{"run", "--log-driver", "k8s-file", "--rm", "--net", netName, "--uidmap", "0:1:4096", ALPINE, "sh", "-c", fmt.Sprintf("echo podman | nc -w 1 %s.dns.podman 8080", name)})
+ run = podmanTest.Podman([]string{"run", "--log-driver", "k8s-file", "--rm", "--net", netName, "--uidmap", "0:1:4096", ALPINE, "sh", "-c", fmt.Sprintf("echo podman | nc -w 1 %s.dns.podman 9480", name)})
run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0))
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index ec4b0d997..b6743f4b7 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -1148,11 +1148,11 @@ USER mail`, BB)
})
It("podman run --pod automatically", func() {
- session := podmanTest.Podman([]string{"run", "-d", "--pod", "new:foobar", ALPINE, "nc", "-l", "-p", "8080"})
+ session := podmanTest.Podman([]string{"run", "-d", "--pod", "new:foobar", ALPINE, "nc", "-l", "-p", "8686"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
- session = podmanTest.Podman([]string{"run", "--pod", "foobar", ALPINE, "/bin/sh", "-c", "echo test | nc -w 1 127.0.0.1 8080"})
+ session = podmanTest.Podman([]string{"run", "--pod", "foobar", ALPINE, "/bin/sh", "-c", "echo test | nc -w 1 127.0.0.1 8686"})
session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0))
diff --git a/test/e2e/run_volume_test.go b/test/e2e/run_volume_test.go
index 59937b6c0..f1baa7780 100644
--- a/test/e2e/run_volume_test.go
+++ b/test/e2e/run_volume_test.go
@@ -242,6 +242,39 @@ var _ = Describe("Podman run with volumes", func() {
Expect(session).Should(Exit(0))
})
+ It("podman support overlay on named volume", func() {
+ SkipIfRemote("Overlay volumes only work locally")
+ if os.Getenv("container") != "" {
+ Skip("Overlay mounts not supported when running in a container")
+ }
+ if rootless.IsRootless() {
+ if _, err := exec.LookPath("fuse-overlayfs"); err != nil {
+ Skip("Fuse-Overlayfs required for rootless overlay mount test")
+ }
+ }
+ session := podmanTest.Podman([]string{"volume", "create", "myvolume"})
+ session.WaitWithDefaultTimeout()
+ volName := session.OutputToString()
+ Expect(session).Should(Exit(0))
+
+ // create file on actual volume
+ session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data", ALPINE, "sh", "-c", "echo hello >> " + "/data/test"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ // create file on overlayed volume
+ session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data:O", ALPINE, "sh", "-c", "echo hello >> " + "/data/overlayed"})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+
+ // volume should contain only `test` not `overlayed`
+ session = podmanTest.Podman([]string{"run", "--volume", volName + ":/data", ALPINE, "sh", "-c", "ls /data"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.OutputToString()).To(Not(ContainSubstring("overlayed")))
+ Expect(session.OutputToString()).To(ContainSubstring("test"))
+
+ })
+
It("podman run with noexec can't exec", func() {
session := podmanTest.Podman([]string{"run", "--rm", "-v", "/bin:/hostbin:noexec", ALPINE, "/hostbin/ls", "/"})
session.WaitWithDefaultTimeout()
@@ -614,7 +647,7 @@ VOLUME /test/`, ALPINE)
Expect(len(session.OutputToStringArray())).To(Equal(2))
})
- It("podman run with U volume flag", func() {
+ It("podman run with --volume and U flag", func() {
SkipIfRemote("Overlay volumes only work locally")
u, err := user.Current()
@@ -665,6 +698,65 @@ VOLUME /test/`, ALPINE)
Expect(found).Should(BeTrue())
})
+ It("podman run with --mount and U flag", func() {
+ u, err := user.Current()
+ Expect(err).To(BeNil())
+ name := u.Username
+ if name == "root" {
+ name = "containers"
+ }
+
+ content, err := ioutil.ReadFile("/etc/subuid")
+ if err != nil {
+ Skip("cannot read /etc/subuid")
+ }
+
+ if !strings.Contains(string(content), name) {
+ Skip("cannot find mappings for the current user")
+ }
+
+ mountPath := filepath.Join(podmanTest.TempDir, "foo")
+ os.Mkdir(mountPath, 0755)
+
+ // false bind mount
+ vol := "type=bind,src=" + mountPath + ",dst=" + dest + ",U=false"
+ session := podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--mount", vol, ALPINE, "stat", "-c", "%u:%g", dest})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).ShouldNot(Equal("888:888"))
+
+ // invalid bind mount
+ vol = "type=bind,src=" + mountPath + ",dst=" + dest + ",U=invalid"
+ session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--mount", vol, ALPINE, "stat", "-c", "%u:%g", dest})
+ session.WaitWithDefaultTimeout()
+ Expect(session).To(ExitWithError())
+
+ // true bind mount
+ vol = "type=bind,src=" + mountPath + ",dst=" + dest + ",U=true"
+ session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--mount", vol, ALPINE, "stat", "-c", "%u:%g", dest})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).Should(Equal("888:888"))
+
+ // tmpfs mount
+ vol = "type=tmpfs," + "dst=" + dest + ",chown"
+ session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--mount", vol, ALPINE, "stat", "-c", "%u:%g", dest})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).Should(Equal("888:888"))
+
+ // named volume mount
+ namedVolume := podmanTest.Podman([]string{"volume", "create", "foo"})
+ namedVolume.WaitWithDefaultTimeout()
+ Expect(namedVolume).Should(Exit(0))
+
+ vol = "type=volume,src=foo,dst=" + dest + ",chown=true"
+ session = podmanTest.Podman([]string{"run", "--rm", "--user", "888:888", "--mount", vol, ALPINE, "stat", "-c", "%u:%g", dest})
+ session.WaitWithDefaultTimeout()
+ Expect(session).Should(Exit(0))
+ Expect(session.OutputToString()).Should(Equal("888:888"))
+ })
+
It("volume permissions after run", func() {
imgName := "testimg"
dockerfile := fmt.Sprintf(`FROM %s
diff --git a/test/e2e/stop_test.go b/test/e2e/stop_test.go
index a984bf6d0..7f178d719 100644
--- a/test/e2e/stop_test.go
+++ b/test/e2e/stop_test.go
@@ -234,6 +234,17 @@ var _ = Describe("Podman stop", func() {
Expect(strings.TrimSpace(finalCtrs.OutputToString())).To(Equal(""))
})
+ It("podman stop should return silent success on stopping configured containers", func() {
+ // following container is not created on OCI runtime
+ // so we return success and assume that is is stopped
+ session2 := podmanTest.Podman([]string{"create", "--name", "stopctr", ALPINE, "/bin/sh"})
+ session2.WaitWithDefaultTimeout()
+ Expect(session2).Should(Exit(0))
+ session3 := podmanTest.Podman([]string{"stop", "stopctr"})
+ session3.WaitWithDefaultTimeout()
+ Expect(session3).Should(Exit(0))
+ })
+
It("podman stop --cidfile", func() {
tmpDir, err := ioutil.TempDir("", "")
diff --git a/test/e2e/system_connection_test.go b/test/e2e/system_connection_test.go
index 21398887a..6cdb78c5e 100644
--- a/test/e2e/system_connection_test.go
+++ b/test/e2e/system_connection_test.go
@@ -138,7 +138,7 @@ var _ = Describe("podman system connection", func() {
It("add tcp", func() {
cmd := []string{"system", "connection", "add",
"QA-TCP",
- "tcp://localhost:8080",
+ "tcp://localhost:8888",
}
session := podmanTest.Podman(cmd)
session.WaitWithDefaultTimeout()
@@ -150,7 +150,7 @@ var _ = Describe("podman system connection", func() {
Expect(cfg.Engine.ActiveService).To(Equal("QA-TCP"))
Expect(cfg.Engine.ServiceDestinations["QA-TCP"]).To(Equal(
config.Destination{
- URI: "tcp://localhost:8080",
+ URI: "tcp://localhost:8888",
Identity: "",
},
))
diff --git a/test/e2e/top_test.go b/test/e2e/top_test.go
index 3cf6244b6..93c4f3f12 100644
--- a/test/e2e/top_test.go
+++ b/test/e2e/top_test.go
@@ -73,6 +73,12 @@ var _ = Describe("Podman top", func() {
result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0))
Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
+
+ // Just a smoke test since groups may change over time.
+ result = podmanTest.Podman([]string{"container", "top", "test", "groups", "hgroups"})
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+ Expect(len(result.OutputToStringArray())).To(BeNumerically(">", 1))
})
It("podman top with options", func() {
diff --git a/test/system/001-basic.bats b/test/system/001-basic.bats
index 963c89281..888c075b8 100644
--- a/test/system/001-basic.bats
+++ b/test/system/001-basic.bats
@@ -57,6 +57,9 @@ function setup() {
# Now untag the digest reference again.
run_podman untag $IMAGE $IMAGE@$digest
+
+ # Make sure the original image is still present (#11557).
+ run_podman image exists $IMAGE
}
# PR #7212: allow --remote anywhere before subcommand, not just as 1st flag
diff --git a/test/system/035-logs.bats b/test/system/035-logs.bats
index a04d2ac74..76ce12b81 100644
--- a/test/system/035-logs.bats
+++ b/test/system/035-logs.bats
@@ -135,31 +135,38 @@ function _log_test_until() {
s_after="after_$(random_string)_${driver}"
before=$(date --iso-8601=seconds)
- sleep 5
+ sleep 1
run_podman run --log-driver=$driver -d --name test $IMAGE sh -c \
"echo $s_before; trap 'echo $s_after; exit' SIGTERM; while :; do sleep 1; done"
# sleep a second to make sure the date is after the first echo
sleep 1
run_podman stop test
- # sleep for 20 seconds to get the proper after time
- sleep 20
+ run_podman wait test
- run_podman logs test
- is "$output" \
- "$s_before
+ # Sigh. Stupid journald has a lag. Wait a few seconds for it to catch up.
+ retries=20
+ s_both="$s_before
$s_after"
+ while [[ $retries -gt 0 ]]; do
+ run_podman logs test
+ if [[ "$output" = "$s_both" ]]; then
+ break
+ fi
+ retries=$((retries - 1))
+ sleep 0.1
+ done
+ if [[ $retries -eq 0 ]]; then
+ die "Timed out waiting for before&after in podman logs: $output"
+ fi
run_podman logs --until $before test
- is "$output" \
- ""
+ is "$output" "" "podman logs --until before"
- after=$(date --iso-8601=seconds)
+ after=$(date --date='+1 second' --iso-8601=seconds)
run_podman logs --until $after test
- is "$output" \
- "$s_before
-$s_after"
+ is "$output" "$s_both" "podman logs --until after"
run_podman rm -f test
}
diff --git a/test/system/040-ps.bats b/test/system/040-ps.bats
index 182d75547..63f57efdc 100644
--- a/test/system/040-ps.bats
+++ b/test/system/040-ps.bats
@@ -90,26 +90,48 @@ load helpers
is "${#lines[@]}" "1" "setup check: no storage containers at start of test"
# Force a buildah timeout; this leaves a buildah container behind
+ local t0=$SECONDS
PODMAN_TIMEOUT=5 run_podman 124 build -t thiswillneverexist - <<EOF
FROM $IMAGE
+RUN touch /intermediate.image.to.be.pruned
RUN sleep 30
EOF
+ local t1=$SECONDS
+ local delta_t=$((t1 - t0))
+ if [[ $delta_t -gt 10 ]]; then
+ # FIXME FIXME FIXME: when buildah issue 3544 gets fixed and vendored,
+ # change 'echo' to 'die'
+ echo "podman build did not get killed within 10 seconds (actual time: $delta_t seconds)"
+ fi
run_podman ps -a
- is "${#lines[@]}" "1" "podman ps -a does not see buildah container"
+ is "${#lines[@]}" "1" "podman ps -a does not see buildah containers"
run_podman ps --external -a
- is "${#lines[@]}" "2" "podman ps -a --external sees buildah container"
+ is "${#lines[@]}" "3" "podman ps -a --external sees buildah containers"
is "${lines[1]}" \
"[0-9a-f]\{12\} \+$IMAGE *buildah .* seconds ago .* storage .* ${PODMAN_TEST_IMAGE_NAME}-working-container" \
"podman ps --external"
- cid="${lines[1]:0:12}"
-
# 'rm -a' should be a NOP
run_podman rm -a
run_podman ps --external -a
- is "${#lines[@]}" "2" "podman ps -a --external sees buildah container"
+ is "${#lines[@]}" "3" "podman ps -a --external sees buildah containers"
+
+ # Cannot prune intermediate image as it's being used by a buildah
+ # container.
+ run_podman image prune -f
+ is "$output" "" "No image is pruned"
+
+ # --external for removing buildah containers.
+ run_podman image prune -f --external
+ is "${#lines[@]}" "1" "Image used by build container is pruned"
+
+ # One buildah container has been removed.
+ run_podman ps --external -a
+ is "${#lines[@]}" "2" "podman ps -a --external sees buildah containers"
+
+ cid="${lines[1]:0:12}"
# We can't rm it without -f, but podman should issue a helpful message
run_podman 2 rm "$cid"
diff --git a/test/system/060-mount.bats b/test/system/060-mount.bats
index 63a93e13b..ba37ea5e1 100644
--- a/test/system/060-mount.bats
+++ b/test/system/060-mount.bats
@@ -125,6 +125,7 @@ load helpers
run_podman exec $cid find /image-mount/etc/
# Clean up
+ run_podman stop -t 0 $cid
run_podman rm -f $cid
}
@@ -147,6 +148,7 @@ load helpers
run_podman inspect --format "{{(index .Mounts 0).RW}}" $cid
is "$output" "true" "inspect data includes image mount source"
+ run_podman stop -t 0 $cid
run_podman rm -f $cid
}
diff --git a/test/system/065-cp.bats b/test/system/065-cp.bats
index 39f439e7b..38c38d671 100644
--- a/test/system/065-cp.bats
+++ b/test/system/065-cp.bats
@@ -256,6 +256,7 @@ load helpers
"
# From RUNNING container
+ local -a destcontainers=()
while read id src dest dest_fullname description; do
# dest may be "''" for empty table cells
if [[ $dest == "''" ]];then
@@ -265,26 +266,25 @@ load helpers
# To RUNNING container
run_podman run -d $IMAGE sleep infinity
destcontainer="$output"
+ destcontainers+=($destcontainer)
run_podman cp cpcontainer:$src $destcontainer:"/$dest"
run_podman exec $destcontainer cat "/$dest_fullname"
is "$output" "${randomcontent[$id]}" "$description (cp ctr:$src to /$dest)"
- run_podman kill $destcontainer
- run_podman rm -f $destcontainer
# To CREATED container
run_podman create $IMAGE sleep infinity
destcontainer="$output"
+ destcontainers+=($destcontainer)
run_podman cp cpcontainer:$src $destcontainer:"/$dest"
run_podman start $destcontainer
run_podman exec $destcontainer cat "/$dest_fullname"
is "$output" "${randomcontent[$id]}" "$description (cp ctr:$src to /$dest)"
- run_podman kill $destcontainer
- run_podman rm -f $destcontainer
done < <(parse_table "$tests")
- run_podman kill cpcontainer
- run_podman rm -f cpcontainer
+ run_podman kill cpcontainer ${destcontainers[@]}
+ run_podman rm -f cpcontainer ${destcontainers[@]}
# From CREATED container
+ destcontainers=()
run_podman create --name cpcontainer --workdir=/srv $cpimage
while read id src dest dest_fullname description; do
# dest may be "''" for empty table cells
@@ -295,23 +295,21 @@ load helpers
# To RUNNING container
run_podman run -d $IMAGE sleep infinity
destcontainer="$output"
+ destcontainers+=($destcontainer)
run_podman cp cpcontainer:$src $destcontainer:"/$dest"
run_podman exec $destcontainer cat "/$dest_fullname"
is "$output" "${randomcontent[$id]}" "$description (cp ctr:$src to /$dest)"
- run_podman kill $destcontainer
- run_podman rm -f $destcontainer
-
# To CREATED container
run_podman create $IMAGE sleep infinity
destcontainer="$output"
+ destcontainers+=($destcontainer)
run_podman cp cpcontainer:$src $destcontainer:"/$dest"
run_podman start $destcontainer
run_podman exec $destcontainer cat "/$dest_fullname"
is "$output" "${randomcontent[$id]}" "$description (cp ctr:$src to /$dest)"
- run_podman kill $destcontainer
- run_podman rm -f $destcontainer
done < <(parse_table "$tests")
- run_podman rm -f cpcontainer
+ run_podman kill ${destcontainers[@]}
+ run_podman rm -f cpcontainer ${destcontainers[@]}
run_podman rmi -f $cpimage
}
@@ -496,6 +494,7 @@ load helpers
"
# From RUNNING container
+ local -a destcontainers=()
while read src dest dest_fullname description; do
if [[ $src == "''" ]];then
unset src
@@ -510,28 +509,27 @@ load helpers
# To RUNNING container
run_podman run -d $IMAGE sleep infinity
destcontainer="$output"
+ destcontainers+=($destcontainer)
run_podman cp cpcontainer:$src $destcontainer:"/$dest"
run_podman exec $destcontainer cat "/$dest_fullname/containerfile0" "/$dest_fullname/containerfile1"
is "$output" "${randomcontent[0]}
${randomcontent[1]}" "$description"
- run_podman kill $destcontainer
- run_podman rm -f $destcontainer
# To CREATED container
run_podman create $IMAGE sleep infinity
destcontainer="$output"
+ destcontainers+=($destcontainer)
run_podman cp cpcontainer:$src $destcontainer:"/$dest"
run_podman start $destcontainer
run_podman exec $destcontainer cat "/$dest_fullname/containerfile0" "/$dest_fullname/containerfile1"
is "$output" "${randomcontent[0]}
${randomcontent[1]}" "$description"
- run_podman kill $destcontainer
- run_podman rm -f $destcontainer
done < <(parse_table "$tests")
- run_podman kill cpcontainer
- run_podman rm -f cpcontainer
+ run_podman kill cpcontainer ${destcontainers[@]}
+ run_podman rm -f cpcontainer ${destcontainers[@]}
# From CREATED container
+ destcontainers=()
run_podman create --name cpcontainer --workdir=/srv $cpimage
while read src dest dest_fullname description; do
if [[ $src == "''" ]];then
@@ -547,26 +545,25 @@ ${randomcontent[1]}" "$description"
# To RUNNING container
run_podman run -d $IMAGE sleep infinity
destcontainer="$output"
+ destcontainers+=($destcontainer)
run_podman cp cpcontainer:$src $destcontainer:"/$dest"
run_podman exec $destcontainer cat "/$dest_fullname/containerfile0" "/$dest_fullname/containerfile1"
is "$output" "${randomcontent[0]}
${randomcontent[1]}" "$description"
- run_podman kill $destcontainer
- run_podman rm -f $destcontainer
# To CREATED container
run_podman create $IMAGE sleep infinity
destcontainer="$output"
+ destcontainers+=($destcontainer)
run_podman start $destcontainer
run_podman cp cpcontainer:$src $destcontainer:"/$dest"
run_podman exec $destcontainer cat "/$dest_fullname/containerfile0" "/$dest_fullname/containerfile1"
is "$output" "${randomcontent[0]}
${randomcontent[1]}" "$description"
- run_podman kill $destcontainer
- run_podman rm -f $destcontainer
done < <(parse_table "$tests")
- run_podman rm -f cpcontainer
+ run_podman kill ${destcontainers[@]}
+ run_podman rm -f cpcontainer ${destcontainers[@]}
run_podman rmi -f $cpimage
}
diff --git a/test/system/070-build.bats b/test/system/070-build.bats
index 03c7984e2..4e89e299a 100644
--- a/test/system/070-build.bats
+++ b/test/system/070-build.bats
@@ -285,21 +285,11 @@ EOF
build_arg_implicit+="=$arg_implicit_value"
fi
- # FIXME FIXME FIXME: 2021-03-15: workaround for #9567 (slow ubuntu 2004):
- # we're seeing lots of timeouts in CI. Until/unless #9567 gets fixed,
- # let's get CI passing by extending the timeout when remote on ubuntu
- local localtimeout=${PODMAN_TIMEOUT}
- if is_remote; then
- if grep -qi ubuntu /etc/os-release; then
- localtimeout=$(( 2 * $localtimeout ))
- fi
- fi
-
# cd to the dir, so we test relative paths (important for podman-remote)
cd $PODMAN_TMPDIR
export arg_explicit="THIS SHOULD BE OVERRIDDEN BY COMMAND LINE!"
export arg_implicit=${arg_implicit_value}
- PODMAN_TIMEOUT=$localtimeout run_podman ${MOUNTS_CONF} build \
+ run_podman ${MOUNTS_CONF} build \
--build-arg arg_explicit=${arg_explicit_value} \
$build_arg_implicit \
--dns-search $nosuchdomain \
@@ -456,16 +446,24 @@ Labels.$label_name | $label_value
@test "podman build - COPY with ignore" {
local tmpdir=$PODMAN_TMPDIR/build-test-$(random_string 10)
- mkdir -p $tmpdir/subdir
+ mkdir -p $tmpdir/subdir{1,2}
# Create a bunch of files. Declare this as an array to avoid duplication
# because we iterate over that list below, checking for each file.
# A leading "-" indicates that the file SHOULD NOT exist in the built image
+ #
+ # Weird side effect of Buildah 3486, relating to subdirectories and
+ # wildcard patterns. See that PR for details, it's way too confusing
+ # to explain in a comment.
local -a files=(
-test1 -test1.txt
test2 test2.txt
- -subdir/sub1 -subdir/sub1.txt
- -subdir/sub2 -subdir/sub2.txt
+ subdir1/sub1 subdir1/sub1.txt
+ -subdir1/sub2 -subdir1/sub2.txt
+ subdir1/sub3 subdir1/sub3.txt
+ -subdir2/sub1 -subdir2/sub1.txt
+ -subdir2/sub2 -subdir2/sub2.txt
+ -subdir2/sub3 -subdir2/sub3.txt
this-file-does-not-match-anything-in-ignore-file
comment
)
@@ -492,8 +490,10 @@ EOF
# comment
test*
!test2*
-subdir
+subdir1
+subdir2
!*/sub1*
+!subdir1/sub3*
EOF
# Build an image. For .dockerignore
@@ -956,6 +956,15 @@ EOF
run_podman build -t build_test $tmpdir
}
+@test "podman build build context is a symlink to a directory" {
+ tmpdir=$PODMAN_TMPDIR/build-test
+ mkdir -p $tmpdir/target
+ ln -s target $tmpdir/link
+ echo FROM $IMAGE > $tmpdir/link/Dockerfile
+ echo RUN echo hello >> $tmpdir/link/Dockerfile
+ run_podman build -t build_test $tmpdir/link
+}
+
function teardown() {
# A timeout or other error in 'build' can leave behind stale images
# that podman can't even see and which will cascade into subsequent
diff --git a/test/system/080-pause.bats b/test/system/080-pause.bats
index 1eb47dcfb..2314324a9 100644
--- a/test/system/080-pause.bats
+++ b/test/system/080-pause.bats
@@ -48,6 +48,7 @@ load helpers
# would imply that the container never paused.
is "$max_delta" "[3456]" "delta t between paused and restarted"
+ run_podman stop -t 0 $cname
run_podman rm -f $cname
# Pause/unpause on nonexistent name or id - these should all fail
@@ -73,6 +74,7 @@ load helpers
is "$output" "$cid" "podman unpause output"
run_podman ps --format '{{.ID}} {{.Names}} {{.Status}}'
is "$output" "${cid:0:12} $cname Up.*" "podman ps on resumed container"
+ run_podman stop -t 0 $cname
run_podman rm -f $cname
run_podman rm -f notrunning
}
diff --git a/test/system/120-load.bats b/test/system/120-load.bats
index 97ea0f528..8be9ed5c5 100644
--- a/test/system/120-load.bats
+++ b/test/system/120-load.bats
@@ -32,7 +32,7 @@ verify_iid_and_name() {
echo "I am an invalid file and should cause a podman-load error" > $invalid
run_podman 125 load -i $invalid
# podman and podman-remote emit different messages; this is a common string
- is "$output" ".*payload does not match any of the supported image formats .*" \
+ is "$output" ".*payload does not match any of the supported image formats:.*" \
"load -i INVALID fails with expected diagnostic"
}
@@ -129,7 +129,7 @@ verify_iid_and_name() {
@test "podman load - redirect corrupt payload" {
run_podman 125 load <<< "Danger, Will Robinson!! This is a corrupt tarball!"
is "$output" \
- ".*payload does not match any of the supported image formats .*" \
+ ".*payload does not match any of the supported image formats:.*" \
"Diagnostic from 'podman load' unknown/corrupt payload"
}
@@ -183,4 +183,16 @@ verify_iid_and_name() {
run_podman rmi -f $img1 $img2
}
+@test "podman save --oci-accept-uncompressed-layers" {
+ archive=$PODMAN_TMPDIR/myimage-$(random_string 8).tar
+ untar=$PODMAN_TMPDIR/myuntar-$(random_string 8)
+ mkdir -p $untar
+
+ # Create a tarball, unpack it and make sure the layers are uncompressed.
+ run_podman save -o $archive --format oci-archive --uncompressed $IMAGE
+ run tar -C $untar -xvf $archive
+ run file $untar/blobs/sha256/*
+ is "$output" ".*POSIX tar archive" "layers are uncompressed"
+}
+
# vim: filetype=sh
diff --git a/test/system/160-volumes.bats b/test/system/160-volumes.bats
index f6dc3f0af..e21be9ea4 100644
--- a/test/system/160-volumes.bats
+++ b/test/system/160-volumes.bats
@@ -21,8 +21,6 @@ function teardown() {
# Simple volume tests: share files between host and container
@test "podman run --volumes : basic" {
- skip_if_remote "volumes cannot be shared across hosts"
-
run_podman volume list --noheading
is "$output" "" "baseline: empty results from list --noheading"
@@ -192,9 +190,12 @@ EOF
run_podman volume create my_vol
run_podman run --rm -v my_vol:/data $IMAGE sh -c "echo hello >> /data/test"
run_podman volume create my_vol2
- run_podman volume export my_vol --output=hello.tar
+
+ tarfile=hello$(random_string | tr A-Z a-z).tar
+ run_podman volume export my_vol --output=$tarfile
# we want to use `run_podman volume export my_vol` but run_podman is wrapping EOF
- cat hello.tar | run_podman volume import my_vol2 -
+ run_podman volume import my_vol2 - < $tarfile
+ rm -f $tarfile
run_podman run --rm -v my_vol2:/data $IMAGE sh -c "cat /data/test"
is "$output" "hello" "output from second container"
run_podman volume rm my_vol
diff --git a/test/system/220-healthcheck.bats b/test/system/220-healthcheck.bats
index e416629e6..28fe8eb92 100644
--- a/test/system/220-healthcheck.bats
+++ b/test/system/220-healthcheck.bats
@@ -12,13 +12,13 @@ function _check_health {
local testname="$1"
local tests="$2"
- run_podman inspect --format json healthcheck_c
+ run_podman inspect --format "{{json .State.Healthcheck}}" healthcheck_c
parse_table "$tests" | while read field expect;do
# (kludge to deal with parse_table and empty strings)
if [ "$expect" = "''" ]; then expect=""; fi
- actual=$(jq -r ".[0].State.Healthcheck.$field" <<<"$output")
+ actual=$(jq -r ".$field" <<<"$output")
is "$actual" "$expect" "$testname - .State.Healthcheck.$field"
done
}
@@ -108,6 +108,7 @@ Log[-1].Output |
is "$output" "unhealthy" "output from 'podman healthcheck run'"
# Clean up
+ run_podman stop -t 0 healthcheck_c
run_podman rm -f healthcheck_c
run_podman rmi healthcheck_i
}
diff --git a/test/system/270-socket-activation.bats b/test/system/270-socket-activation.bats
index 031ba161b..dd439d3ae 100644
--- a/test/system/270-socket-activation.bats
+++ b/test/system/270-socket-activation.bats
@@ -69,26 +69,36 @@ function teardown() {
@test "podman system service - socket activation - no container" {
run curl -s --max-time 3 --unix-socket $SERVICE_SOCK_ADDR http://podman/libpod/_ping
- is "$output" "OK" "podman service responses normally"
+ is "$output" "OK" "podman service responds normally"
}
-@test "podman system service - socket activation - exist container " {
- run_podman run $IMAGE sleep 90
+@test "podman system service - socket activation - existing container" {
+ run_podman run -d $IMAGE sleep 90
+ cid="$output"
+
run curl -s --max-time 3 --unix-socket $SERVICE_SOCK_ADDR http://podman/libpod/_ping
- is "$output" "OK" "podman service responses normally"
+ is "$output" "OK" "podman service responds normally"
+
+ run_podman stop -t 0 $cid
+ run_podman rm -f $cid
}
-@test "podman system service - socket activation - kill rootless pause " {
+@test "podman system service - socket activation - kill rootless pause" {
if ! is_rootless; then
skip "root podman no need pause process"
fi
- run_podman run $IMAGE sleep 90
+ run_podman run -d $IMAGE sleep 90
+ cid="$output"
+
local pause_pid="$XDG_RUNTIME_DIR/libpod/tmp/pause.pid"
if [ -f $pause_pid ]; then
kill -9 $(cat $pause_pid) 2> /dev/null
fi
run curl -s --max-time 3 --unix-socket $SERVICE_SOCK_ADDR http://podman/libpod/_ping
- is "$output" "OK" "podman service responses normally"
+ is "$output" "OK" "podman service responds normally"
+
+ run_podman stop -t 0 $cid
+ run_podman rm -f $cid
}
# vim: filetype=sh
diff --git a/test/system/330-corrupt-images.bats b/test/system/330-corrupt-images.bats
index eeffff3ec..86da06cb0 100644
--- a/test/system/330-corrupt-images.bats
+++ b/test/system/330-corrupt-images.bats
@@ -78,7 +78,7 @@ function _corrupt_image_test() {
# Run the requested command. Confirm it succeeds, with suitable warnings
run_podman $*
- is "$output" ".*error determining parent of image.*ignoring the error" \
+ is "$output" ".*Failed to determine parent of image.*ignoring the error" \
"$* with missing $what_to_rm"
run_podman images -a --noheading
diff --git a/test/system/410-selinux.bats b/test/system/410-selinux.bats
index 5ee0e0715..0f7c35c65 100644
--- a/test/system/410-selinux.bats
+++ b/test/system/410-selinux.bats
@@ -113,6 +113,10 @@ function check_label() {
@test "podman selinux: shared context in (some) namespaces" {
skip_if_no_selinux
+ # rootless users have no usable cgroups with cgroupsv1, so containers
+ # must use a pid namespace and not join an existing one.
+ skip_if_rootless_cgroupsv1
+
run_podman run -d --name myctr $IMAGE top
run_podman exec myctr cat -v /proc/self/attr/current
context_c1="$output"
diff --git a/test/system/420-cgroups.bats b/test/system/420-cgroups.bats
index 89c81a742..025a20012 100644
--- a/test/system/420-cgroups.bats
+++ b/test/system/420-cgroups.bats
@@ -8,9 +8,7 @@ load helpers
@test "podman run, preserves initial --cgroup-manager" {
skip_if_remote "podman-remote does not support --cgroup-manager"
- if is_rootless && is_cgroupsv1; then
- skip "not supported as rootless under cgroups v1"
- fi
+ skip_if_rootless_cgroupsv1
# Find out our default cgroup manager, and from that, get the non-default
run_podman info --format '{{.Host.CgroupManager}}'
diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats
index ef00d0366..548f2d764 100644
--- a/test/system/500-networking.bats
+++ b/test/system/500-networking.bats
@@ -415,6 +415,10 @@ load helpers
run_podman inspect $cid --format "{{(index .NetworkSettings.Networks \"$netname\").MacAddress}}"
mac="$output"
+ # check network alias for container short id
+ run_podman inspect $cid --format "{{(index .NetworkSettings.Networks \"$netname\").Aliases}}"
+ is "$output" "\[${cid:0:12}\]" "short container id in network aliases"
+
run_podman network disconnect $netname $cid
# check that we cannot curl (timeout after 3 sec)
@@ -443,6 +447,10 @@ load helpers
# connect a second network
run_podman network connect $netname2 $cid
+ # check network2 alias for container short id
+ run_podman inspect $cid --format "{{(index .NetworkSettings.Networks \"$netname2\").Aliases}}"
+ is "$output" "\[${cid:0:12}\]" "short container id in network aliases"
+
# curl should work
run curl --max-time 3 -s $SERVER/index.txt
is "$output" "$random_1" "curl 127.0.0.1:/index.txt should work"
diff --git a/test/system/600-completion.bats b/test/system/600-completion.bats
index fbb0da231..5f4610e9e 100644
--- a/test/system/600-completion.bats
+++ b/test/system/600-completion.bats
@@ -110,12 +110,10 @@ function check_shell_completion() {
is "$output" ".*localhost/$random_image_name:$random_image_tag${nl}" \
"$* $cmd: actual image listed in suggestions"
- # check that we complete the image with and without tag after at least one char is typed
+ # check that we complete the image with tag after at least one char is typed
run_completion "$@" $cmd "${extra_args[@]}" "${random_image_name:0:1}"
is "$output" ".*$random_image_name:$random_image_tag${nl}" \
"$* $cmd: image name:tag included in suggestions"
- is "$output" ".*$random_image_name${nl}" \
- "$* $cmd: image name(w/o tag) included in suggestions"
# check that we complete the image id after at least two chars are typed
run_completion "$@" $cmd "${extra_args[@]}" "${random_image_id:0:2}"
diff --git a/test/system/700-play.bats b/test/system/700-play.bats
index 2b05cdd84..0785bffdf 100644
--- a/test/system/700-play.bats
+++ b/test/system/700-play.bats
@@ -69,11 +69,15 @@ RELABEL="system_u:object_r:container_file_t:s0"
TESTDIR=$PODMAN_TMPDIR/testdir
mkdir -p $TESTDIR
echo "$testYaml" | sed "s|TESTDIR|${TESTDIR}|g" > $PODMAN_TMPDIR/test.yaml
+
run_podman play kube - < $PODMAN_TMPDIR/test.yaml
if [ -e /usr/sbin/selinuxenabled -a /usr/sbin/selinuxenabled ]; then
run ls -Zd $TESTDIR
is "$output" ${RELABEL} "selinux relabel should have happened"
fi
+
+ run_podman stop -a -t 0
+ run_podman pod stop test_pod
run_podman pod rm -f test_pod
}
@@ -86,6 +90,9 @@ RELABEL="system_u:object_r:container_file_t:s0"
run ls -Zd $TESTDIR
is "$output" ${RELABEL} "selinux relabel should have happened"
fi
+
+ run_podman stop -a -t 0
+ run_podman pod stop test_pod
run_podman pod rm -f test_pod
}
@@ -102,12 +109,19 @@ RELABEL="system_u:object_r:container_file_t:s0"
infraID="$output"
run_podman container inspect --format "{{.HostConfig.NetworkMode}}" $infraID
is "$output" "slirp4netns" "network mode slirp4netns is set for the container"
+
+ run_podman stop -a -t 0
+ run_podman pod stop test_pod
run_podman pod rm -f test_pod
+
run_podman play kube --network none $PODMAN_TMPDIR/test.yaml
run_podman pod inspect --format {{.InfraContainerID}} "${lines[1]}"
infraID="$output"
run_podman container inspect --format "{{.HostConfig.NetworkMode}}" $infraID
is "$output" "none" "network mode none is set for the container"
+
+ run_podman stop -a -t 0
+ run_podman pod stop test_pod
run_podman pod rm -f test_pod
}
@@ -149,6 +163,9 @@ _EOF
run_podman play kube --start=false $PODMAN_TMPDIR/test.yaml
run_podman inspect --format "{{ .Config.User }}" test_pod-test
is "$output" bin "expect container within pod to run as the bin user"
+
+ run_podman stop -a -t 0
+ run_podman pod stop test_pod
run_podman pod rm -f test_pod
run_podman rmi -f userimage:latest
}
diff --git a/test/system/helpers.bash b/test/system/helpers.bash
index 28ea924bb..666735b0c 100644
--- a/test/system/helpers.bash
+++ b/test/system/helpers.bash
@@ -428,6 +428,18 @@ function skip_if_cgroupsv1() {
fi
}
+######################
+# skip_if_rootless_cgroupsv1 # ...with an optional message
+######################
+function skip_if_rootless_cgroupsv1() {
+ if is_rootless; then
+ if ! is_cgroupsv2; then
+ local msg=$(_add_label_if_missing "$1" "rootless cgroupvs1")
+ skip "${msg:-not supported as rootless under cgroupsv1}"
+ fi
+ fi
+}
+
##################################
# skip_if_journald_unavailable # rhbz#1895105: rootless journald permissions
##################################
diff --git a/test/testvol/main.go b/test/testvol/main.go
index 721f47bcd..a0f58348b 100644
--- a/test/testvol/main.go
+++ b/test/testvol/main.go
@@ -59,7 +59,7 @@ func before(cmd *cobra.Command, args []string) error {
func main() {
if err := rootCmd.Execute(); err != nil {
- logrus.Errorf("Error running volume plugin: %v", err)
+ logrus.Errorf("Running volume plugin: %v", err)
os.Exit(1)
}
diff --git a/test/utils/utils.go b/test/utils/utils.go
index 80af7fb7c..bfefc58ec 100644
--- a/test/utils/utils.go
+++ b/test/utils/utils.go
@@ -19,7 +19,7 @@ import (
)
var (
- defaultWaitTimeout = 90
+ DefaultWaitTimeout = 90
OSReleasePath = "/etc/os-release"
ProcessOneCgroupPath = "/proc/1/cgroup"
)
@@ -317,15 +317,20 @@ func (s *PodmanSession) IsJSONOutputValid() bool {
return true
}
-// WaitWithDefaultTimeout waits for process finished with defaultWaitTimeout
+// WaitWithDefaultTimeout waits for process finished with DefaultWaitTimeout
func (s *PodmanSession) WaitWithDefaultTimeout() {
- Eventually(s, defaultWaitTimeout).Should(Exit())
+ s.WaitWithTimeout(DefaultWaitTimeout)
+}
+
+// WaitWithTimeout waits for process finished with DefaultWaitTimeout
+func (s *PodmanSession) WaitWithTimeout(timeout int) {
+ Eventually(s, timeout).Should(Exit())
os.Stdout.Sync()
os.Stderr.Sync()
fmt.Println("output:", s.OutputToString())
}
-// CreateTempDirinTempDir create a temp dir with prefix podman_test
+// CreateTempDirInTempDir create a temp dir with prefix podman_test
func CreateTempDirInTempDir() (string, error) {
return ioutil.TempDir("", "podman_test")
}
@@ -337,7 +342,7 @@ func SystemExec(command string, args []string) *PodmanSession {
if err != nil {
Fail(fmt.Sprintf("unable to run command: %s %s", command, strings.Join(args, " ")))
}
- session.Wait(defaultWaitTimeout)
+ session.Wait(DefaultWaitTimeout)
return &PodmanSession{session}
}
diff --git a/test/version/main.go b/test/version/main.go
new file mode 100644
index 000000000..2a751de78
--- /dev/null
+++ b/test/version/main.go
@@ -0,0 +1,11 @@
+package main
+
+import (
+ "fmt"
+
+ "github.com/containers/podman/v3/version"
+)
+
+func main() {
+ fmt.Printf(version.Version.String())
+}