e2e: remove "-it" from podman run & exec

...at least as many as possible. "run/exec -it" make no sense
in a CI environment; I believe the vast majority of these are
the result of fingers typing on autopilot, then copy/pasting
cascades from those. This PR gets rid of as many -it/-ti as
possible. Some are still needed for testing purposes.

Y'all have no idea how much I hate #10927 (the "no logs from conmon"
flake). This does not fix the underlying problem, nor does it even
eliminate the flake (The "exec terminal doesn't hang" test needs
to keep the -ti flag, and that's one of the most popular flakers).
But this at least reduces the scope of the problem. It also removes
a ton of nasty orange "input device is not a TTY" warnings from logs.

Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
Ed Santiago 2023-04-25 07:09:05 -06:00
parent 846e7aa21b
commit eeb210bc56
24 changed files with 132 additions and 133 deletions

View File

@ -65,7 +65,6 @@ var _ = Describe("Podman checkpoint", func() {
localRunString := []string{ localRunString := []string{
"run", "run",
"-it",
"-d", "-d",
"--ip", GetRandomIPAddress(), "--ip", GetRandomIPAddress(),
"--name", containerName, "--name", containerName,

View File

@ -245,7 +245,7 @@ var _ = Describe("Podman commit", func() {
}) })
It("podman commit container check env variables", func() { It("podman commit container check env variables", func() {
s := podmanTest.Podman([]string{"run", "--name", "test1", "-e", "TEST=1=1-01=9.01", "-it", "alpine", "true"}) s := podmanTest.Podman([]string{"run", "--name", "test1", "-e", "TEST=1=1-01=9.01", "alpine", "true"})
s.WaitWithDefaultTimeout() s.WaitWithDefaultTimeout()
Expect(s).Should(Exit(0)) Expect(s).Should(Exit(0))

View File

@ -247,7 +247,7 @@ var _ = Describe("Podman cp", func() {
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
// owner of the file copied to a container is the root user // owner of the file copied to a container is the root user
session = podmanTest.Podman([]string{"exec", "-it", "testctr", "ls", "-l", "testfile2"}) session = podmanTest.Podman([]string{"exec", "testctr", "ls", "-l", "testfile2"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("root")) Expect(session.OutputToString()).To(ContainSubstring("root"))

View File

@ -467,7 +467,7 @@ var _ = Describe("Podman exec", func() {
groupName := "group1" groupName := "group1"
gid := "4444" gid := "4444"
ctrName1 := "ctr1" ctrName1 := "ctr1"
ctr1 := podmanTest.Podman([]string{"run", "-ti", "--name", ctrName1, fedoraMinimal, "groupadd", "-g", gid, groupName}) ctr1 := podmanTest.Podman([]string{"run", "--name", ctrName1, fedoraMinimal, "groupadd", "-g", gid, groupName})
ctr1.WaitWithDefaultTimeout() ctr1.WaitWithDefaultTimeout()
Expect(ctr1).Should(Exit(0)) Expect(ctr1).Should(Exit(0))
@ -481,7 +481,7 @@ var _ = Describe("Podman exec", func() {
ctr2.WaitWithDefaultTimeout() ctr2.WaitWithDefaultTimeout()
Expect(ctr2).Should(Exit(0)) Expect(ctr2).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-ti", ctrName2, "id"}) exec := podmanTest.Podman([]string{"exec", ctrName2, "id"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
Expect(exec.OutputToString()).To(ContainSubstring(fmt.Sprintf("%s(%s)", gid, groupName))) Expect(exec.OutputToString()).To(ContainSubstring(fmt.Sprintf("%s(%s)", gid, groupName)))
@ -496,11 +496,11 @@ RUN useradd -u 1000 auser`, fedoraMinimal)
podmanTest.BuildImage(dockerfile, imgName, "false") podmanTest.BuildImage(dockerfile, imgName, "false")
ctrName := "testctr" ctrName := "testctr"
ctr := podmanTest.Podman([]string{"run", "-t", "-i", "-d", "--name", ctrName, "--user", "auser:first", "--group-add", "second", imgName, "sleep", "300"}) ctr := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, "--user", "auser:first", "--group-add", "second", imgName, "sleep", "300"})
ctr.WaitWithDefaultTimeout() ctr.WaitWithDefaultTimeout()
Expect(ctr).Should(Exit(0)) Expect(ctr).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-t", ctrName, "id"}) exec := podmanTest.Podman([]string{"exec", ctrName, "id"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
output := exec.OutputToString() output := exec.OutputToString()
@ -516,11 +516,11 @@ RUN useradd -u 1000 auser`, fedoraMinimal)
It("podman exec --detach", func() { It("podman exec --detach", func() {
ctrName := "testctr" ctrName := "testctr"
ctr := podmanTest.Podman([]string{"run", "-t", "-i", "-d", "--name", ctrName, ALPINE, "top"}) ctr := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, ALPINE, "top"})
ctr.WaitWithDefaultTimeout() ctr.WaitWithDefaultTimeout()
Expect(ctr).Should(Exit(0)) Expect(ctr).Should(Exit(0))
exec1 := podmanTest.Podman([]string{"exec", "-t", "-i", "-d", ctrName, "top"}) exec1 := podmanTest.Podman([]string{"exec", "-d", ctrName, "top"})
exec1.WaitWithDefaultTimeout() exec1.WaitWithDefaultTimeout()
Expect(ctr).Should(Exit(0)) Expect(ctr).Should(Exit(0))
@ -529,7 +529,7 @@ RUN useradd -u 1000 auser`, fedoraMinimal)
Expect(data[0].ExecIDs).To(HaveLen(1)) Expect(data[0].ExecIDs).To(HaveLen(1))
Expect(exec1.OutputToString()).To(ContainSubstring(data[0].ExecIDs[0])) Expect(exec1.OutputToString()).To(ContainSubstring(data[0].ExecIDs[0]))
exec2 := podmanTest.Podman([]string{"exec", "-t", "-i", ctrName, "ps", "-a"}) exec2 := podmanTest.Podman([]string{"exec", ctrName, "ps", "-a"})
exec2.WaitWithDefaultTimeout() exec2.WaitWithDefaultTimeout()
Expect(ctr).Should(Exit(0)) Expect(ctr).Should(Exit(0))
Expect(strings.Count(exec2.OutputToString(), "top")).To(Equal(2)) Expect(strings.Count(exec2.OutputToString(), "top")).To(Equal(2))
@ -551,7 +551,7 @@ RUN useradd -u 1000 auser`, fedoraMinimal)
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "-t", "-i", "-d", "--secret", "source=mysecret,type=env", "--name", "secr", ALPINE, "top"}) session = podmanTest.Podman([]string{"run", "-d", "--secret", "source=mysecret,type=env", "--name", "secr", ALPINE, "top"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))

View File

@ -287,7 +287,7 @@ var _ = Describe("Podman logs", func() {
It("podman logs on a created container should result in 0 exit code: "+log, func() { It("podman logs on a created container should result in 0 exit code: "+log, func() {
skipIfJournaldInContainer() skipIfJournaldInContainer()
session := podmanTest.Podman([]string{"create", "--log-driver", log, "-t", "--name", "log", ALPINE}) session := podmanTest.Podman([]string{"create", "--log-driver", log, "--name", "log", ALPINE})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).To(Exit(0)) Expect(session).To(Exit(0))
@ -382,7 +382,7 @@ var _ = Describe("Podman logs", func() {
It("Make sure logs match expected length: "+log, func() { It("Make sure logs match expected length: "+log, func() {
skipIfJournaldInContainer() skipIfJournaldInContainer()
logc := podmanTest.Podman([]string{"run", "--log-driver", log, "-t", "--name", "test", ALPINE, "sh", "-c", "echo 1; echo 2"}) logc := podmanTest.Podman([]string{"run", "--log-driver", log, "--name", "test", ALPINE, "sh", "-c", "echo 1; echo 2"})
logc.WaitWithDefaultTimeout() logc.WaitWithDefaultTimeout()
Expect(logc).To(Exit(0)) Expect(logc).To(Exit(0))
@ -395,8 +395,8 @@ var _ = Describe("Podman logs", func() {
Expect(results).To(Exit(0)) Expect(results).To(Exit(0))
outlines := results.OutputToStringArray() outlines := results.OutputToStringArray()
Expect(outlines).To(HaveLen(2)) Expect(outlines).To(HaveLen(2))
Expect(outlines[0]).To(Equal("1\r")) Expect(outlines[0]).To(Equal("1"))
Expect(outlines[1]).To(Equal("2\r")) Expect(outlines[1]).To(Equal("2"))
}) })
It("podman logs test stdout and stderr: "+log, func() { It("podman logs test stdout and stderr: "+log, func() {

View File

@ -87,11 +87,11 @@ var _ = Describe("Podman network connect and disconnect", func() {
ctr.WaitWithDefaultTimeout() ctr.WaitWithDefaultTimeout()
Expect(ctr).Should(Exit(0)) Expect(ctr).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"}) exec := podmanTest.Podman([]string{"exec", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
exec2 := podmanTest.Podman([]string{"exec", "-it", "test", "cat", "/etc/resolv.conf"}) exec2 := podmanTest.Podman([]string{"exec", "test", "cat", "/etc/resolv.conf"})
exec2.WaitWithDefaultTimeout() exec2.WaitWithDefaultTimeout()
Expect(exec2).Should(Exit(0)) Expect(exec2).Should(Exit(0))
Expect(exec2.OutputToString()).To(ContainSubstring(ns)) Expect(exec2.OutputToString()).To(ContainSubstring(ns))
@ -106,11 +106,11 @@ var _ = Describe("Podman network connect and disconnect", func() {
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal("0")) Expect(inspect.OutputToString()).To(Equal("0"))
exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"}) exec = podmanTest.Podman([]string{"exec", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(ExitWithError()) Expect(exec).Should(ExitWithError())
exec3 := podmanTest.Podman([]string{"exec", "-it", "test", "cat", "/etc/resolv.conf"}) exec3 := podmanTest.Podman([]string{"exec", "test", "cat", "/etc/resolv.conf"})
exec3.WaitWithDefaultTimeout() exec3.WaitWithDefaultTimeout()
Expect(exec3).Should(Exit(0)) Expect(exec3).Should(Exit(0))
Expect(exec3.OutputToString()).ToNot(ContainSubstring(ns)) Expect(exec3.OutputToString()).ToNot(ContainSubstring(ns))
@ -201,7 +201,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
Expect(ctr).Should(Exit(0)) Expect(ctr).Should(Exit(0))
cid := ctr.OutputToString() cid := ctr.OutputToString()
exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"}) exec := podmanTest.Podman([]string{"exec", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
@ -217,7 +217,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
Expect(gw).Should(Exit(0)) Expect(gw).Should(Exit(0))
ns := gw.OutputToString() ns := gw.OutputToString()
exec2 := podmanTest.Podman([]string{"exec", "-it", "test", "cat", "/etc/resolv.conf"}) exec2 := podmanTest.Podman([]string{"exec", "test", "cat", "/etc/resolv.conf"})
exec2.WaitWithDefaultTimeout() exec2.WaitWithDefaultTimeout()
Expect(exec2).Should(Exit(0)) Expect(exec2).Should(Exit(0))
Expect(exec2.OutputToString()).ToNot(ContainSubstring(ns)) Expect(exec2.OutputToString()).ToNot(ContainSubstring(ns))
@ -240,13 +240,13 @@ var _ = Describe("Podman network connect and disconnect", func() {
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal("[" + cid[0:12] + "]")) Expect(inspect.OutputToString()).To(Equal("[" + cid[0:12] + "]"))
exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth1"}) exec = podmanTest.Podman([]string{"exec", "test", "ip", "addr", "show", "eth1"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
Expect(exec.OutputToString()).Should(ContainSubstring(ip)) Expect(exec.OutputToString()).Should(ContainSubstring(ip))
Expect(exec.OutputToString()).Should(ContainSubstring(mac)) Expect(exec.OutputToString()).Should(ContainSubstring(mac))
exec3 := podmanTest.Podman([]string{"exec", "-it", "test", "cat", "/etc/resolv.conf"}) exec3 := podmanTest.Podman([]string{"exec", "test", "cat", "/etc/resolv.conf"})
exec3.WaitWithDefaultTimeout() exec3.WaitWithDefaultTimeout()
Expect(exec3).Should(Exit(0)) Expect(exec3).Should(Exit(0))
Expect(exec3.OutputToString()).To(ContainSubstring(ns)) Expect(exec3.OutputToString()).To(ContainSubstring(ns))
@ -293,11 +293,11 @@ var _ = Describe("Podman network connect and disconnect", func() {
start.WaitWithDefaultTimeout() start.WaitWithDefaultTimeout()
Expect(start).Should(Exit(0)) Expect(start).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"}) exec := podmanTest.Podman([]string{"exec", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth1"}) exec = podmanTest.Podman([]string{"exec", "test", "ip", "addr", "show", "eth1"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
}) })
@ -318,7 +318,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
ctr.WaitWithDefaultTimeout() ctr.WaitWithDefaultTimeout()
Expect(ctr).Should(Exit(0)) Expect(ctr).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"}) exec := podmanTest.Podman([]string{"exec", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
@ -344,7 +344,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
Expect(inspect.OutputToString()).To(ContainSubstring(netName)) Expect(inspect.OutputToString()).To(ContainSubstring(netName))
Expect(inspect.OutputToString()).To(ContainSubstring(newNetName)) Expect(inspect.OutputToString()).To(ContainSubstring(newNetName))
exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth1"}) exec = podmanTest.Podman([]string{"exec", "test", "ip", "addr", "show", "eth1"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
}) })
@ -379,7 +379,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
start.WaitWithDefaultTimeout() start.WaitWithDefaultTimeout()
Expect(start).Should(Exit(0)) Expect(start).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"}) exec := podmanTest.Podman([]string{"exec", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
// because the network interface order is not guaranteed to be the same we have to check both eth0 and eth1 // because the network interface order is not guaranteed to be the same we have to check both eth0 and eth1
@ -389,7 +389,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
exitMatcher = Exit(0) exitMatcher = Exit(0)
} }
exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth1"}) exec = podmanTest.Podman([]string{"exec", "test", "ip", "addr", "show", "eth1"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(exitMatcher) Expect(exec).Should(exitMatcher)
}) })
@ -410,7 +410,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
ctr.WaitWithDefaultTimeout() ctr.WaitWithDefaultTimeout()
Expect(ctr).Should(Exit(0)) Expect(ctr).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"}) exec := podmanTest.Podman([]string{"exec", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
@ -423,7 +423,7 @@ var _ = Describe("Podman network connect and disconnect", func() {
Expect(inspect).Should(Exit(0)) Expect(inspect).Should(Exit(0))
Expect(inspect.OutputToString()).To(Equal("0")) Expect(inspect.OutputToString()).To(Equal("0"))
exec = podmanTest.Podman([]string{"exec", "-it", "test", "ip", "addr", "show", "eth0"}) exec = podmanTest.Podman([]string{"exec", "test", "ip", "addr", "show", "eth0"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(ExitWithError()) Expect(exec).Should(ExitWithError())
}) })

View File

@ -70,7 +70,7 @@ var _ = Describe("Podman network create", func() {
// best we can // best we can
defer removeNetworkDevice(result.NetworkInterface) defer removeNetworkDevice(result.NetworkInterface)
try := podmanTest.Podman([]string{"run", "-it", "--rm", "--network", netName, ALPINE, "sh", "-c", "ip addr show eth0 | awk ' /inet / {print $2}'"}) try := podmanTest.Podman([]string{"run", "--rm", "--network", netName, ALPINE, "sh", "-c", "ip addr show eth0 | awk ' /inet / {print $2}'"})
try.WaitWithDefaultTimeout() try.WaitWithDefaultTimeout()
Expect(try).To(Exit(0)) Expect(try).To(Exit(0))
@ -110,7 +110,7 @@ var _ = Describe("Podman network create", func() {
// best we can // best we can
defer removeNetworkDevice(result.NetworkInterface) defer removeNetworkDevice(result.NetworkInterface)
try := podmanTest.Podman([]string{"run", "-it", "--rm", "--network", netName, ALPINE, "sh", "-c", "ip addr show eth0 | grep global | awk ' /inet6 / {print $2}'"}) try := podmanTest.Podman([]string{"run", "--rm", "--network", netName, ALPINE, "sh", "-c", "ip addr show eth0 | grep global | awk ' /inet6 / {print $2}'"})
try.WaitWithDefaultTimeout() try.WaitWithDefaultTimeout()
Expect(try).To(Exit(0)) Expect(try).To(Exit(0))
@ -186,7 +186,7 @@ var _ = Describe("Podman network create", func() {
Expect(subnet11.Contains(subnet21.IP)).To(BeFalse()) Expect(subnet11.Contains(subnet21.IP)).To(BeFalse())
Expect(subnet12.Contains(subnet22.IP)).To(BeFalse()) Expect(subnet12.Contains(subnet22.IP)).To(BeFalse())
try := podmanTest.Podman([]string{"run", "-it", "--rm", "--network", netName, ALPINE, "sh", "-c", "ip addr show eth0 | grep global | awk ' /inet6 / {print $2}'"}) try := podmanTest.Podman([]string{"run", "--rm", "--network", netName, ALPINE, "sh", "-c", "ip addr show eth0 | grep global | awk ' /inet6 / {print $2}'"})
try.WaitWithDefaultTimeout() try.WaitWithDefaultTimeout()
_, subnet, err := net.ParseCIDR("fd00:4:3:2:1::/64") _, subnet, err := net.ParseCIDR("fd00:4:3:2:1::/64")
@ -196,7 +196,7 @@ var _ = Describe("Podman network create", func() {
// Ensure that the IP the container got is within the subnet the user asked for // Ensure that the IP the container got is within the subnet the user asked for
Expect(subnet.Contains(containerIP)).To(BeTrue()) Expect(subnet.Contains(containerIP)).To(BeTrue())
// verify the container has an IPv4 address too (the IPv4 subnet is autogenerated) // verify the container has an IPv4 address too (the IPv4 subnet is autogenerated)
try = podmanTest.Podman([]string{"run", "-it", "--rm", "--network", netName, ALPINE, "sh", "-c", "ip addr show eth0 | awk ' /inet / {print $2}'"}) try = podmanTest.Podman([]string{"run", "--rm", "--network", netName, ALPINE, "sh", "-c", "ip addr show eth0 | awk ' /inet / {print $2}'"})
try.WaitWithDefaultTimeout() try.WaitWithDefaultTimeout()
containerIP, _, err = net.ParseCIDR(try.OutputToString()) containerIP, _, err = net.ParseCIDR(try.OutputToString())
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())

View File

@ -1794,7 +1794,7 @@ func testPodWithSecret(podmanTest *PodmanTestIntegration, podYamlString, fileNam
} }
Expect(kube).Should(Exit(0)) Expect(kube).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-it", "mypod-myctr", "cat", "/etc/foo/username"}) exec := podmanTest.Podman([]string{"exec", "mypod-myctr", "cat", "/etc/foo/username"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
if exists { if exists {
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
@ -4783,19 +4783,19 @@ ENV OPENJ9_JAVA_OPTIONS=%q
kube.WaitWithDefaultTimeout() kube.WaitWithDefaultTimeout()
Expect(kube).Should(Exit(0)) Expect(kube).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-it", "mypod2-myctr", "cat", "/etc/foo/username"}) exec := podmanTest.Podman([]string{"exec", "mypod2-myctr", "cat", "/etc/foo/username"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
username, _ := base64.StdEncoding.DecodeString("dXNlcg==") username, _ := base64.StdEncoding.DecodeString("dXNlcg==")
Expect(exec.OutputToString()).Should(ContainSubstring(string(username))) Expect(exec.OutputToString()).Should(ContainSubstring(string(username)))
exec = podmanTest.Podman([]string{"exec", "-it", "mypod2-myctr", "cat", "/etc/bar/username"}) exec = podmanTest.Podman([]string{"exec", "mypod2-myctr", "cat", "/etc/bar/username"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
username, _ = base64.StdEncoding.DecodeString("Y2RvZXJu") username, _ = base64.StdEncoding.DecodeString("Y2RvZXJu")
Expect(exec.OutputToString()).Should(ContainSubstring(string(username))) Expect(exec.OutputToString()).Should(ContainSubstring(string(username)))
exec = podmanTest.Podman([]string{"exec", "-it", "mypod2-myctr", "cat", "/etc/baz/plain_note"}) exec = podmanTest.Podman([]string{"exec", "mypod2-myctr", "cat", "/etc/baz/plain_note"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
Expect(exec.OutputToString()).Should(ContainSubstring("This is a test")) Expect(exec.OutputToString()).Should(ContainSubstring("This is a test"))
@ -4983,7 +4983,7 @@ spec:
playKube.WaitWithDefaultTimeout() playKube.WaitWithDefaultTimeout()
Expect(playKube).Should(Exit(0)) Expect(playKube).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-it", "testpod-testctr", "cat", "/var/123.txt"}) exec := podmanTest.Podman([]string{"exec", "testpod-testctr", "cat", "/var/123.txt"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
Expect(exec.OutputToString()).Should(Equal("hi")) Expect(exec.OutputToString()).Should(Equal("hi"))
@ -5012,7 +5012,7 @@ spec:
playKube := podmanTest.Podman([]string{"play", "kube", kubeYaml}) playKube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
playKube.WaitWithDefaultTimeout() playKube.WaitWithDefaultTimeout()
Expect(playKube).Should(Exit(0)) Expect(playKube).Should(Exit(0))
exec := podmanTest.Podman([]string{"exec", "-it", "testpod-testctr", "ls", "/var"}) exec := podmanTest.Podman([]string{"exec", "testpod-testctr", "ls", "/var"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
Expect(exec.OutputToString()).Should(ContainSubstring("123.txt")) Expect(exec.OutputToString()).Should(ContainSubstring("123.txt"))
@ -5095,7 +5095,7 @@ spec:
kube.WaitWithDefaultTimeout() kube.WaitWithDefaultTimeout()
Expect(kube).Should(Exit(0), string(out)) Expect(kube).Should(Exit(0), string(out))
exec := podmanTest.Podman([]string{"exec", "-it", "testpod-testctr", "ls", "/etc/"}) exec := podmanTest.Podman([]string{"exec", "testpod-testctr", "ls", "/etc/"})
exec.WaitWithDefaultTimeout() exec.WaitWithDefaultTimeout()
Expect(exec).Should(Exit(0)) Expect(exec).Should(Exit(0))
Expect(exec.OutputToString()).ShouldNot(HaveLen(3)) Expect(exec.OutputToString()).ShouldNot(HaveLen(3))

View File

@ -148,7 +148,7 @@ var _ = Describe("Podman pod clone", func() {
podClone.WaitWithDefaultTimeout() podClone.WaitWithDefaultTimeout()
Expect(podClone).Should(Exit(0)) Expect(podClone).Should(Exit(0))
run := podmanTest.Podman([]string{"run", "-it", "--pod", podClone.OutputToString(), ALPINE, "mount"}) run := podmanTest.Podman([]string{"run", "--pod", podClone.OutputToString(), ALPINE, "mount"})
run.WaitWithDefaultTimeout() run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0)) Expect(run).Should(Exit(0))
t, strings := run.GrepString("shm on /dev/shm type tmpfs") t, strings := run.GrepString("shm on /dev/shm type tmpfs")
@ -167,7 +167,7 @@ var _ = Describe("Podman pod clone", func() {
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "-it", "--pod", session.OutputToString(), ALPINE, "printenv", "HOSTNAME"}) session = podmanTest.Podman([]string{"run", "--pod", session.OutputToString(), ALPINE, "printenv", "HOSTNAME"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(hostname)) Expect(session.OutputToString()).To(ContainSubstring(hostname))

View File

@ -132,11 +132,11 @@ var _ = Describe("Podman pod create", func() {
podCreate.WaitWithDefaultTimeout() podCreate.WaitWithDefaultTimeout()
Expect(podCreate).Should(Exit(0)) Expect(podCreate).Should(Exit(0))
alpineResolvConf := podmanTest.Podman([]string{"run", "-ti", "--rm", "--no-hosts", ALPINE, "cat", "/etc/hosts"}) alpineResolvConf := podmanTest.Podman([]string{"run", "--rm", "--no-hosts", ALPINE, "cat", "/etc/hosts"})
alpineResolvConf.WaitWithDefaultTimeout() alpineResolvConf.WaitWithDefaultTimeout()
Expect(alpineResolvConf).Should(Exit(0)) Expect(alpineResolvConf).Should(Exit(0))
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/hosts"}) podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "--rm", ALPINE, "cat", "/etc/hosts"})
podResolvConf.WaitWithDefaultTimeout() podResolvConf.WaitWithDefaultTimeout()
Expect(podResolvConf).Should(Exit(0)) Expect(podResolvConf).Should(Exit(0))
Expect(podResolvConf.OutputToString()).To(Equal(alpineResolvConf.OutputToString())) Expect(podResolvConf.OutputToString()).To(Equal(alpineResolvConf.OutputToString()))
@ -155,7 +155,7 @@ var _ = Describe("Podman pod create", func() {
podCreate.WaitWithDefaultTimeout() podCreate.WaitWithDefaultTimeout()
Expect(podCreate).Should(Exit(0)) Expect(podCreate).Should(Exit(0))
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/hosts"}) podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "--rm", ALPINE, "cat", "/etc/hosts"})
podResolvConf.WaitWithDefaultTimeout() podResolvConf.WaitWithDefaultTimeout()
Expect(podResolvConf).Should(Exit(0)) Expect(podResolvConf).Should(Exit(0))
Expect(podResolvConf.OutputToString()).To(ContainSubstring("12.34.56.78 test.example.com")) Expect(podResolvConf.OutputToString()).To(ContainSubstring("12.34.56.78 test.example.com"))
@ -175,7 +175,7 @@ var _ = Describe("Podman pod create", func() {
podCreate.WaitWithDefaultTimeout() podCreate.WaitWithDefaultTimeout()
Expect(podCreate).Should(Exit(0)) Expect(podCreate).Should(Exit(0))
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/resolv.conf"}) podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "--rm", ALPINE, "cat", "/etc/resolv.conf"})
podResolvConf.WaitWithDefaultTimeout() podResolvConf.WaitWithDefaultTimeout()
Expect(podResolvConf).Should(Exit(0)) Expect(podResolvConf).Should(Exit(0))
Expect(podResolvConf.OutputToString()).To(ContainSubstring("nameserver %s", server)) Expect(podResolvConf.OutputToString()).To(ContainSubstring("nameserver %s", server))
@ -196,7 +196,7 @@ var _ = Describe("Podman pod create", func() {
podCreate.WaitWithDefaultTimeout() podCreate.WaitWithDefaultTimeout()
Expect(podCreate).Should(Exit(0)) Expect(podCreate).Should(Exit(0))
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/resolv.conf"}) podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "--rm", ALPINE, "cat", "/etc/resolv.conf"})
podResolvConf.WaitWithDefaultTimeout() podResolvConf.WaitWithDefaultTimeout()
Expect(podResolvConf).Should(Exit(0)) Expect(podResolvConf).Should(Exit(0))
Expect(podResolvConf.OutputToString()).To(ContainSubstring(fmt.Sprintf("options %s", option))) Expect(podResolvConf.OutputToString()).To(ContainSubstring(fmt.Sprintf("options %s", option)))
@ -217,7 +217,7 @@ var _ = Describe("Podman pod create", func() {
podCreate.WaitWithDefaultTimeout() podCreate.WaitWithDefaultTimeout()
Expect(podCreate).Should(Exit(0)) Expect(podCreate).Should(Exit(0))
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "cat", "/etc/resolv.conf"}) podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "--rm", ALPINE, "cat", "/etc/resolv.conf"})
podResolvConf.WaitWithDefaultTimeout() podResolvConf.WaitWithDefaultTimeout()
Expect(podResolvConf).Should(Exit(0)) Expect(podResolvConf).Should(Exit(0))
Expect(podResolvConf.OutputToString()).To(ContainSubstring(fmt.Sprintf("search %s", search))) Expect(podResolvConf.OutputToString()).To(ContainSubstring(fmt.Sprintf("search %s", search)))
@ -241,7 +241,7 @@ var _ = Describe("Podman pod create", func() {
Expect(podCreate).Should(Exit(125)) Expect(podCreate).Should(Exit(125))
} else { } else {
Expect(podCreate).Should(Exit(0)) Expect(podCreate).Should(Exit(0))
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "ip", "addr"}) podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "--rm", ALPINE, "ip", "addr"})
podResolvConf.WaitWithDefaultTimeout() podResolvConf.WaitWithDefaultTimeout()
Expect(podResolvConf).Should(Exit(0)) Expect(podResolvConf).Should(Exit(0))
Expect(podResolvConf.OutputToString()).To(ContainSubstring(ip)) Expect(podResolvConf.OutputToString()).To(ContainSubstring(ip))
@ -284,7 +284,7 @@ var _ = Describe("Podman pod create", func() {
Expect(podCreate).Should(Exit(125)) Expect(podCreate).Should(Exit(125))
} else { } else {
Expect(podCreate).Should(Exit(0)) Expect(podCreate).Should(Exit(0))
podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "-ti", "--rm", ALPINE, "ip", "addr"}) podResolvConf := podmanTest.Podman([]string{"run", "--pod", name, "--rm", ALPINE, "ip", "addr"})
podResolvConf.WaitWithDefaultTimeout() podResolvConf.WaitWithDefaultTimeout()
Expect(podResolvConf).Should(Exit(0)) Expect(podResolvConf).Should(Exit(0))
Expect(podResolvConf.OutputToString()).To(ContainSubstring(mac)) Expect(podResolvConf.OutputToString()).To(ContainSubstring(mac))
@ -985,7 +985,7 @@ ENTRYPOINT ["sleep","99999"]
podCreate.WaitWithDefaultTimeout() podCreate.WaitWithDefaultTimeout()
Expect(podCreate).Should(Exit(0)) Expect(podCreate).Should(Exit(0))
ctrCreate = podmanTest.Podman([]string{"container", "run", "-it", "--pod", podCreate.OutputToString(), ALPINE, "cat", "/proc/self/attr/current"}) ctrCreate = podmanTest.Podman([]string{"container", "run", "--pod", podCreate.OutputToString(), ALPINE, "cat", "/proc/self/attr/current"})
ctrCreate.WaitWithDefaultTimeout() ctrCreate.WaitWithDefaultTimeout()
Expect(ctrCreate).Should(Exit(0)) Expect(ctrCreate).Should(Exit(0))
match, _ := ctrCreate.GrepString("spc_t") match, _ := ctrCreate.GrepString("spc_t")
@ -1134,7 +1134,7 @@ ENTRYPOINT ["sleep","99999"]
podCreate.WaitWithDefaultTimeout() podCreate.WaitWithDefaultTimeout()
Expect(podCreate).Should(Exit(0)) Expect(podCreate).Should(Exit(0))
run := podmanTest.Podman([]string{"run", "-it", "--pod", podCreate.OutputToString(), ALPINE, "mount"}) run := podmanTest.Podman([]string{"run", "--pod", podCreate.OutputToString(), ALPINE, "mount"})
run.WaitWithDefaultTimeout() run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0)) Expect(run).Should(Exit(0))
t, strings := run.GrepString("shm on /dev/shm type tmpfs") t, strings := run.GrepString("shm on /dev/shm type tmpfs")
@ -1157,7 +1157,7 @@ ENTRYPOINT ["sleep","99999"]
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"run", "-it", "--pod", session.OutputToString(), ALPINE, "printenv", "HOSTNAME"}) session = podmanTest.Podman([]string{"run", "--pod", session.OutputToString(), ALPINE, "printenv", "HOSTNAME"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(hostname)) Expect(session.OutputToString()).To(ContainSubstring(hostname))

View File

@ -91,7 +91,7 @@ var _ = Describe("Podman init containers", func() {
start := podmanTest.Podman([]string{"pod", "start", "foobar"}) start := podmanTest.Podman([]string{"pod", "start", "foobar"})
start.WaitWithDefaultTimeout() start.WaitWithDefaultTimeout()
Expect(start).Should(Exit(0)) Expect(start).Should(Exit(0))
checkLog := podmanTest.Podman([]string{"exec", "-it", verify.OutputToString(), "cat", filename}) checkLog := podmanTest.Podman([]string{"exec", verify.OutputToString(), "cat", filename})
checkLog.WaitWithDefaultTimeout() checkLog.WaitWithDefaultTimeout()
Expect(checkLog).Should(Exit(0)) Expect(checkLog).Should(Exit(0))
Expect(checkLog.OutputToString()).To(Equal(content)) Expect(checkLog.OutputToString()).To(Equal(content))
@ -124,7 +124,7 @@ var _ = Describe("Podman init containers", func() {
Expect(startPod).Should(Exit(0)) Expect(startPod).Should(Exit(0))
// Because no init was run, the file should not even exist // Because no init was run, the file should not even exist
doubleCheck := podmanTest.Podman([]string{"exec", "-it", verify.OutputToString(), "cat", filename}) doubleCheck := podmanTest.Podman([]string{"exec", verify.OutputToString(), "cat", filename})
doubleCheck.WaitWithDefaultTimeout() doubleCheck.WaitWithDefaultTimeout()
Expect(doubleCheck).Should(Exit(1)) Expect(doubleCheck).Should(Exit(1))
@ -145,7 +145,7 @@ var _ = Describe("Podman init containers", func() {
Expect(start).Should(Exit(0)) Expect(start).Should(Exit(0))
// capture the date written // capture the date written
checkLog := podmanTest.Podman([]string{"exec", "-it", verify.OutputToString(), "cat", filename}) checkLog := podmanTest.Podman([]string{"exec", verify.OutputToString(), "cat", filename})
checkLog.WaitWithDefaultTimeout() checkLog.WaitWithDefaultTimeout()
firstResult := checkLog.OutputToString() firstResult := checkLog.OutputToString()
Expect(checkLog).Should(Exit(0)) Expect(checkLog).Should(Exit(0))
@ -159,7 +159,7 @@ var _ = Describe("Podman init containers", func() {
Expect(startPod).Should(Exit(0)) Expect(startPod).Should(Exit(0))
// Check the file again with exec // Check the file again with exec
secondCheckLog := podmanTest.Podman([]string{"exec", "-it", verify.OutputToString(), "cat", filename}) secondCheckLog := podmanTest.Podman([]string{"exec", verify.OutputToString(), "cat", filename})
secondCheckLog.WaitWithDefaultTimeout() secondCheckLog.WaitWithDefaultTimeout()
Expect(secondCheckLog).Should(Exit(0)) Expect(secondCheckLog).Should(Exit(0))

View File

@ -375,7 +375,7 @@ var _ = Describe("Podman ps", func() {
}) })
It("podman ps filter by exited does not need all", func() { It("podman ps filter by exited does not need all", func() {
ctr := podmanTest.Podman([]string{"run", "-t", "-i", ALPINE, "ls", "/"}) ctr := podmanTest.Podman([]string{"run", ALPINE, "ls", "/"})
ctr.WaitWithDefaultTimeout() ctr.WaitWithDefaultTimeout()
Expect(ctr).Should(Exit(0)) Expect(ctr).Should(Exit(0))
@ -392,7 +392,7 @@ var _ = Describe("Podman ps", func() {
It("podman filter without status does not find non-running", func() { It("podman filter without status does not find non-running", func() {
ctrName := "aContainerName" ctrName := "aContainerName"
ctr := podmanTest.Podman([]string{"create", "--name", ctrName, "-t", "-i", ALPINE, "ls", "/"}) ctr := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE, "ls", "/"})
ctr.WaitWithDefaultTimeout() ctr.WaitWithDefaultTimeout()
Expect(ctr).Should(Exit(0)) Expect(ctr).Should(Exit(0))
@ -420,7 +420,7 @@ var _ = Describe("Podman ps", func() {
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "-t", ALPINE, "top"}) session = podmanTest.Podman([]string{"create", ALPINE, "top"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
@ -435,7 +435,7 @@ var _ = Describe("Podman ps", func() {
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"create", "-t", ALPINE, "top"}) session = podmanTest.Podman([]string{"create", ALPINE, "top"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))

View File

@ -93,7 +93,7 @@ var _ = Describe("Podman run dns", func() {
}) })
It("podman run add hostname sets /etc/hosts", func() { It("podman run add hostname sets /etc/hosts", func() {
session := podmanTest.Podman([]string{"run", "-t", "-i", "--hostname=foobar", ALPINE, "cat", "/etc/hosts"}) session := podmanTest.Podman([]string{"run", "--hostname=foobar", ALPINE, "cat", "/etc/hosts"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("foobar")) Expect(session.OutputToString()).To(ContainSubstring("foobar"))

View File

@ -68,7 +68,7 @@ var _ = Describe("Podman run networking", func() {
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "-i", "con1", "nslookup", "google.com", aardvarkDNSGateway}) session = podmanTest.Podman([]string{"exec", "con1", "nslookup", "google.com", aardvarkDNSGateway})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("Non-authoritative answer: Name: google.com Address:")) Expect(session.OutputToString()).To(ContainSubstring("Non-authoritative answer: Name: google.com Address:"))
@ -83,7 +83,7 @@ var _ = Describe("Podman run networking", func() {
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
session = podmanTest.Podman([]string{"exec", "-i", "con1", "nslookup", "google.com", aardvarkDNSGateway}) session = podmanTest.Podman([]string{"exec", "con1", "nslookup", "google.com", aardvarkDNSGateway})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(1)) Expect(session).Should(Exit(1))
Expect(session.OutputToString()).To(ContainSubstring(";; connection timed out; no servers could be reached")) Expect(session.OutputToString()).To(ContainSubstring(";; connection timed out; no servers could be reached"))
@ -721,12 +721,12 @@ EXPOSE 2004-2005/tcp`, ALPINE)
ctr2.WaitWithDefaultTimeout() ctr2.WaitWithDefaultTimeout()
Expect(ctr2).Should(Exit(0)) Expect(ctr2).Should(Exit(0))
exec3 := podmanTest.Podman([]string{"exec", "-i", ctrName2, "cat", "/etc/resolv.conf"}) exec3 := podmanTest.Podman([]string{"exec", ctrName2, "cat", "/etc/resolv.conf"})
exec3.WaitWithDefaultTimeout() exec3.WaitWithDefaultTimeout()
Expect(exec3).Should(Exit(0)) Expect(exec3).Should(Exit(0))
Expect(exec3.OutputToString()).To(ContainSubstring("nameserver 192.0.2.1")) Expect(exec3.OutputToString()).To(ContainSubstring("nameserver 192.0.2.1"))
exec4 := podmanTest.Podman([]string{"exec", "-i", ctrName2, "cat", "/etc/hosts"}) exec4 := podmanTest.Podman([]string{"exec", ctrName2, "cat", "/etc/hosts"})
exec4.WaitWithDefaultTimeout() exec4.WaitWithDefaultTimeout()
Expect(exec4).Should(Exit(0)) Expect(exec4).Should(Exit(0))
Expect(exec4.OutputToString()).To(ContainSubstring("192.0.2.2 test1")) Expect(exec4.OutputToString()).To(ContainSubstring("192.0.2.2 test1"))
@ -958,7 +958,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
Expect(create).Should(Exit(0)) Expect(create).Should(Exit(0))
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
run := podmanTest.Podman([]string{"run", "-t", "-i", "--rm", "--net", netName, "--ip", ipAddr, ALPINE, "ip", "addr"}) run := podmanTest.Podman([]string{"run", "--rm", "--net", netName, "--ip", ipAddr, ALPINE, "ip", "addr"})
run.WaitWithDefaultTimeout() run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0)) Expect(run).Should(Exit(0))
Expect(run.OutputToString()).To(ContainSubstring(ipAddr)) Expect(run.OutputToString()).To(ContainSubstring(ipAddr))
@ -998,7 +998,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
Expect(create).Should(Exit(0)) Expect(create).Should(Exit(0))
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
run := podmanTest.Podman([]string{"run", "-t", "-i", "--rm", "--pod", "new:" + podname, "--net", netName, "--ip", ipAddr, ALPINE, "ip", "addr"}) run := podmanTest.Podman([]string{"run", "--rm", "--pod", "new:" + podname, "--net", netName, "--ip", ipAddr, ALPINE, "ip", "addr"})
run.WaitWithDefaultTimeout() run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0)) Expect(run).Should(Exit(0))
Expect(run.OutputToString()).To(ContainSubstring(ipAddr)) Expect(run.OutputToString()).To(ContainSubstring(ipAddr))

View File

@ -140,7 +140,7 @@ var _ = Describe("Podman privileged container tests", func() {
mknod.WaitWithDefaultTimeout() mknod.WaitWithDefaultTimeout()
Expect(mknod).Should(Exit(0)) Expect(mknod).Should(Exit(0))
session := podmanTest.Podman([]string{"run", "--name=" + containerName, "--privileged", "-it", fedoraMinimal, "ls", "/dev"}) session := podmanTest.Podman([]string{"run", "--name=" + containerName, "--privileged", fedoraMinimal, "ls", "/dev"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))

View File

@ -45,21 +45,21 @@ var _ = Describe("Podman run", func() {
}) })
It("podman run selinux grep test", func() { It("podman run selinux grep test", func() {
session := podmanTest.Podman([]string{"run", "-it", "--security-opt", "label=level:s0:c1,c2", ALPINE, "cat", "/proc/self/attr/current"}) session := podmanTest.Podman([]string{"run", "--security-opt", "label=level:s0:c1,c2", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("s0:c1,c2")) Expect(session.OutputToString()).To(ContainSubstring("s0:c1,c2"))
}) })
It("podman run selinux disable test", func() { It("podman run selinux disable test", func() {
session := podmanTest.Podman([]string{"run", "-it", "--security-opt", "label=disable", ALPINE, "cat", "/proc/self/attr/current"}) session := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("spc_t")) Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
}) })
It("podman run selinux type check test", func() { It("podman run selinux type check test", func() {
session := podmanTest.Podman([]string{"run", "-it", ALPINE, "cat", "/proc/self/attr/current"}) session := podmanTest.Podman([]string{"run", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
match1, _ := session.GrepString("container_t") match1, _ := session.GrepString("container_t")
@ -68,7 +68,7 @@ var _ = Describe("Podman run", func() {
}) })
It("podman run selinux type setup test", func() { It("podman run selinux type setup test", func() {
session := podmanTest.Podman([]string{"run", "-it", "--security-opt", "label=type:spc_t", ALPINE, "cat", "/proc/self/attr/current"}) session := podmanTest.Podman([]string{"run", "--security-opt", "label=type:spc_t", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("spc_t")) Expect(session.OutputToString()).To(ContainSubstring("spc_t"))
@ -138,12 +138,12 @@ var _ = Describe("Podman run", func() {
}) })
It("podman run selinux file type setup test", func() { It("podman run selinux file type setup test", func() {
session := podmanTest.Podman([]string{"run", "-it", "--security-opt", "label=type:spc_t", "--security-opt", "label=filetype:container_var_lib_t", fedoraMinimal, "ls", "-Z", "/dev"}) session := podmanTest.Podman([]string{"run", "--security-opt", "label=type:spc_t", "--security-opt", "label=filetype:container_var_lib_t", fedoraMinimal, "ls", "-Z", "/dev"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("container_var_lib_t")) Expect(session.OutputToString()).To(ContainSubstring("container_var_lib_t"))
session = podmanTest.Podman([]string{"run", "-it", "--security-opt", "label=type:spc_t", "--security-opt", "label=filetype:foobar", fedoraMinimal, "ls", "-Z", "/dev"}) session = podmanTest.Podman([]string{"run", "--security-opt", "label=type:spc_t", "--security-opt", "label=filetype:foobar", fedoraMinimal, "ls", "-Z", "/dev"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(126)) Expect(session).Should(Exit(126))
}) })
@ -161,7 +161,7 @@ var _ = Describe("Podman run", func() {
}) })
It("podman run --privileged and --security-opt SELinux options", func() { It("podman run --privileged and --security-opt SELinux options", func() {
session := podmanTest.Podman([]string{"run", "-it", "--privileged", "--security-opt", "label=type:spc_t", "--security-opt", "label=level:s0:c1,c2", ALPINE, "cat", "/proc/self/attr/current"}) session := podmanTest.Podman([]string{"run", "--privileged", "--security-opt", "label=type:spc_t", "--security-opt", "label=level:s0:c1,c2", ALPINE, "cat", "/proc/self/attr/current"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("spc_t")) Expect(session.OutputToString()).To(ContainSubstring("spc_t"))

View File

@ -58,7 +58,7 @@ var _ = Describe("Podman run with --sig-proxy", func() {
err = podmanTest.RestoreArtifact(fedoraMinimal) err = podmanTest.RestoreArtifact(fedoraMinimal)
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
} }
_, pid := podmanTest.PodmanPID([]string{"run", "-it", "-v", fmt.Sprintf("%s:/h:Z", udsDir), fedoraMinimal, "bash", "-c", sigCatch}) _, pid := podmanTest.PodmanPID([]string{"run", "-v", fmt.Sprintf("%s:/h:Z", udsDir), fedoraMinimal, "bash", "-c", sigCatch})
uds, _ := os.OpenFile(udsPath, os.O_RDONLY|syscall.O_NONBLOCK, 0600) uds, _ := os.OpenFile(udsPath, os.O_RDONLY|syscall.O_NONBLOCK, 0600)
defer uds.Close() defer uds.Close()

View File

@ -40,26 +40,26 @@ var _ = Describe("Podman run with --ip flag", func() {
}) })
It("Podman run --ip with garbage address", func() { It("Podman run --ip with garbage address", func() {
result := podmanTest.Podman([]string{"run", "-ti", "--ip", "114232346", ALPINE, "ls"}) result := podmanTest.Podman([]string{"run", "--ip", "114232346", ALPINE, "ls"})
result.WaitWithDefaultTimeout() result.WaitWithDefaultTimeout()
Expect(result).To(ExitWithError()) Expect(result).To(ExitWithError())
}) })
It("Podman run --ip with v6 address", func() { It("Podman run --ip with v6 address", func() {
result := podmanTest.Podman([]string{"run", "-ti", "--ip", "2001:db8:bad:beef::1", ALPINE, "ls"}) result := podmanTest.Podman([]string{"run", "--ip", "2001:db8:bad:beef::1", ALPINE, "ls"})
result.WaitWithDefaultTimeout() result.WaitWithDefaultTimeout()
Expect(result).To(ExitWithError()) Expect(result).To(ExitWithError())
}) })
It("Podman run --ip with non-allocatable IP", func() { It("Podman run --ip with non-allocatable IP", func() {
result := podmanTest.Podman([]string{"run", "-ti", "--ip", "203.0.113.124", ALPINE, "ls"}) result := podmanTest.Podman([]string{"run", "--ip", "203.0.113.124", ALPINE, "ls"})
result.WaitWithDefaultTimeout() result.WaitWithDefaultTimeout()
Expect(result).To(ExitWithError()) Expect(result).To(ExitWithError())
}) })
It("Podman run with specified static IP has correct IP", func() { It("Podman run with specified static IP has correct IP", func() {
ip := GetRandomIPAddress() ip := GetRandomIPAddress()
result := podmanTest.Podman([]string{"run", "-ti", "--ip", ip, ALPINE, "ip", "addr"}) result := podmanTest.Podman([]string{"run", "--ip", ip, ALPINE, "ip", "addr"})
result.WaitWithDefaultTimeout() result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0)) Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring(ip + "/16")) Expect(result.OutputToString()).To(ContainSubstring(ip + "/16"))
@ -73,7 +73,7 @@ var _ = Describe("Podman run with --ip flag", func() {
defer podmanTest.removeNetwork(netName) defer podmanTest.removeNetwork(netName)
Expect(net).To(Exit(0)) Expect(net).To(Exit(0))
result := podmanTest.Podman([]string{"run", "-ti", "--network", netName, "--ip6", ipv6, ALPINE, "ip", "addr"}) result := podmanTest.Podman([]string{"run", "--network", netName, "--ip6", ipv6, ALPINE, "ip", "addr"})
result.WaitWithDefaultTimeout() result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0)) Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring(ipv6 + "/64")) Expect(result.OutputToString()).To(ContainSubstring(ipv6 + "/64"))
@ -81,7 +81,7 @@ var _ = Describe("Podman run with --ip flag", func() {
It("Podman run with --network bridge:ip=", func() { It("Podman run with --network bridge:ip=", func() {
ip := GetRandomIPAddress() ip := GetRandomIPAddress()
result := podmanTest.Podman([]string{"run", "-ti", "--network", "bridge:ip=" + ip, ALPINE, "ip", "addr"}) result := podmanTest.Podman([]string{"run", "--network", "bridge:ip=" + ip, ALPINE, "ip", "addr"})
result.WaitWithDefaultTimeout() result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0)) Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring(ip + "/16")) Expect(result.OutputToString()).To(ContainSubstring(ip + "/16"))
@ -91,7 +91,7 @@ var _ = Describe("Podman run with --ip flag", func() {
ip := GetRandomIPAddress() ip := GetRandomIPAddress()
mac := "44:33:22:11:00:99" mac := "44:33:22:11:00:99"
intName := "myeth" intName := "myeth"
result := podmanTest.Podman([]string{"run", "-ti", "--network", "bridge:ip=" + ip + ",mac=" + mac + ",interface_name=" + intName, ALPINE, "ip", "addr"}) result := podmanTest.Podman([]string{"run", "--network", "bridge:ip=" + ip + ",mac=" + mac + ",interface_name=" + intName, ALPINE, "ip", "addr"})
result.WaitWithDefaultTimeout() result.WaitWithDefaultTimeout()
Expect(result).Should(Exit(0)) Expect(result).Should(Exit(0))
Expect(result.OutputToString()).To(ContainSubstring(ip + "/16")) Expect(result.OutputToString()).To(ContainSubstring(ip + "/16"))

View File

@ -182,7 +182,7 @@ var _ = Describe("Podman run", func() {
It("podman create pod with name in /etc/hosts", func() { It("podman create pod with name in /etc/hosts", func() {
name := "test_container" name := "test_container"
hostname := "test_hostname" hostname := "test_hostname"
session := podmanTest.Podman([]string{"run", "-ti", "--rm", "--name", name, "--hostname", hostname, ALPINE, "cat", "/etc/hosts"}) session := podmanTest.Podman([]string{"run", "--rm", "--name", name, "--hostname", hostname, ALPINE, "cat", "/etc/hosts"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(name)) Expect(session.OutputToString()).To(ContainSubstring(name))
@ -440,28 +440,28 @@ var _ = Describe("Podman run", func() {
}) })
It("podman run seccomp test", func() { It("podman run seccomp test", func() {
session := podmanTest.Podman([]string{"run", "-it", "--security-opt", strings.Join([]string{"seccomp=", forbidGetCWDSeccompProfile()}, ""), ALPINE, "pwd"}) session := podmanTest.Podman([]string{"run", "--security-opt", strings.Join([]string{"seccomp=", forbidGetCWDSeccompProfile()}, ""), ALPINE, "pwd"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError()) Expect(session).To(ExitWithError())
Expect(session.OutputToString()).To(ContainSubstring("Operation not permitted")) Expect(session.ErrorToString()).To(ContainSubstring("Operation not permitted"))
}) })
It("podman run seccomp test --privileged", func() { It("podman run seccomp test --privileged", func() {
session := podmanTest.Podman([]string{"run", "-it", "--privileged", "--security-opt", strings.Join([]string{"seccomp=", forbidGetCWDSeccompProfile()}, ""), ALPINE, "pwd"}) session := podmanTest.Podman([]string{"run", "--privileged", "--security-opt", strings.Join([]string{"seccomp=", forbidGetCWDSeccompProfile()}, ""), ALPINE, "pwd"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).To(ExitWithError()) Expect(session).To(ExitWithError())
Expect(session.OutputToString()).To(ContainSubstring("Operation not permitted")) Expect(session.ErrorToString()).To(ContainSubstring("Operation not permitted"))
}) })
It("podman run seccomp test --privileged no profile should be unconfined", func() { It("podman run seccomp test --privileged no profile should be unconfined", func() {
session := podmanTest.Podman([]string{"run", "-it", "--privileged", ALPINE, "grep", "Seccomp", "/proc/self/status"}) session := podmanTest.Podman([]string{"run", "--privileged", ALPINE, "grep", "Seccomp", "/proc/self/status"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session.OutputToString()).To(ContainSubstring("0")) Expect(session.OutputToString()).To(ContainSubstring("0"))
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
}) })
It("podman run seccomp test no profile should be default", func() { It("podman run seccomp test no profile should be default", func() {
session := podmanTest.Podman([]string{"run", "-it", ALPINE, "grep", "Seccomp", "/proc/self/status"}) session := podmanTest.Podman([]string{"run", ALPINE, "grep", "Seccomp", "/proc/self/status"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session.OutputToString()).To(ContainSubstring("2")) Expect(session.OutputToString()).To(ContainSubstring("2"))
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
@ -1589,7 +1589,7 @@ USER mail`, BB)
It("podman run --privileged and --group-add", func() { It("podman run --privileged and --group-add", func() {
groupName := "mail" groupName := "mail"
session := podmanTest.Podman([]string{"run", "-t", "-i", "--group-add", groupName, "--privileged", fedoraMinimal, "groups"}) session := podmanTest.Podman([]string{"run", "--group-add", groupName, "--privileged", fedoraMinimal, "groups"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring(groupName)) Expect(session.OutputToString()).To(ContainSubstring(groupName))

View File

@ -95,7 +95,7 @@ var _ = Describe("Podman UserNS support", func() {
// https://github.com/containers/podman/pull/1066#issuecomment-403562116 // https://github.com/containers/podman/pull/1066#issuecomment-403562116
// To avoid a potential future regression, use this as a test. // To avoid a potential future regression, use this as a test.
It("podman uidmapping and gidmapping with short-opts", func() { It("podman uidmapping and gidmapping with short-opts", func() {
session := podmanTest.Podman([]string{"run", "--uidmap=0:1:5000", "--gidmap=0:200:5000", "-it", "alpine", "echo", "hello"}) session := podmanTest.Podman([]string{"run", "--uidmap=0:1:5000", "--gidmap=0:200:5000", "alpine", "echo", "hello"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).To(ContainSubstring("hello")) Expect(session.OutputToString()).To(ContainSubstring("hello"))
@ -179,12 +179,12 @@ var _ = Describe("Podman UserNS support", func() {
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
exec1 := podmanTest.Podman([]string{"exec", "-t", "-i", ctrName, "cat", "/etc/passwd"}) exec1 := podmanTest.Podman([]string{"exec", ctrName, "cat", "/etc/passwd"})
exec1.WaitWithDefaultTimeout() exec1.WaitWithDefaultTimeout()
Expect(exec1).Should(Exit(0)) Expect(exec1).Should(Exit(0))
Expect(exec1.OutputToString()).To(ContainSubstring(userName)) Expect(exec1.OutputToString()).To(ContainSubstring(userName))
exec2 := podmanTest.Podman([]string{"exec", "-t", "-i", ctrName, "useradd", "testuser"}) exec2 := podmanTest.Podman([]string{"exec", ctrName, "useradd", "testuser"})
exec2.WaitWithDefaultTimeout() exec2.WaitWithDefaultTimeout()
Expect(exec2).Should(Exit(0)) Expect(exec2).Should(Exit(0))
}) })

View File

@ -432,12 +432,12 @@ var _ = Describe("Podman run with volumes", func() {
}) })
It("podman named volume copyup", func() { It("podman named volume copyup", func() {
baselineSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", ALPINE, "ls", "/etc/apk/"}) baselineSession := podmanTest.Podman([]string{"run", "--rm", ALPINE, "ls", "/etc/apk/"})
baselineSession.WaitWithDefaultTimeout() baselineSession.WaitWithDefaultTimeout()
Expect(baselineSession).Should(Exit(0)) Expect(baselineSession).Should(Exit(0))
baselineOutput := baselineSession.OutputToString() baselineOutput := baselineSession.OutputToString()
inlineVolumeSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", "-v", "testvol1:/etc/apk", ALPINE, "ls", "/etc/apk/"}) inlineVolumeSession := podmanTest.Podman([]string{"run", "--rm", "-v", "testvol1:/etc/apk", ALPINE, "ls", "/etc/apk/"})
inlineVolumeSession.WaitWithDefaultTimeout() inlineVolumeSession.WaitWithDefaultTimeout()
Expect(inlineVolumeSession).Should(Exit(0)) Expect(inlineVolumeSession).Should(Exit(0))
Expect(inlineVolumeSession.OutputToString()).To(Equal(baselineOutput)) Expect(inlineVolumeSession.OutputToString()).To(Equal(baselineOutput))
@ -446,7 +446,7 @@ var _ = Describe("Podman run with volumes", func() {
makeVolumeSession.WaitWithDefaultTimeout() makeVolumeSession.WaitWithDefaultTimeout()
Expect(makeVolumeSession).Should(Exit(0)) Expect(makeVolumeSession).Should(Exit(0))
separateVolumeSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", "-v", "testvol2:/etc/apk", ALPINE, "ls", "/etc/apk/"}) separateVolumeSession := podmanTest.Podman([]string{"run", "--rm", "-v", "testvol2:/etc/apk", ALPINE, "ls", "/etc/apk/"})
separateVolumeSession.WaitWithDefaultTimeout() separateVolumeSession.WaitWithDefaultTimeout()
Expect(separateVolumeSession).Should(Exit(0)) Expect(separateVolumeSession).Should(Exit(0))
Expect(separateVolumeSession.OutputToString()).To(Equal(baselineOutput)) Expect(separateVolumeSession.OutputToString()).To(Equal(baselineOutput))
@ -467,47 +467,47 @@ RUN touch /testfile
RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE) RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
podmanTest.BuildImage(dockerfile, imgName, "false") podmanTest.BuildImage(dockerfile, imgName, "false")
baselineSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", imgName, "ls", "/etc/apk/"}) baselineSession := podmanTest.Podman([]string{"run", "--rm", imgName, "ls", "/etc/apk/"})
baselineSession.WaitWithDefaultTimeout() baselineSession.WaitWithDefaultTimeout()
Expect(baselineSession).Should(Exit(0)) Expect(baselineSession).Should(Exit(0))
baselineOutput := baselineSession.OutputToString() baselineOutput := baselineSession.OutputToString()
outputSession := podmanTest.Podman([]string{"run", "-t", "-i", "-v", "/etc/apk/", imgName, "ls", "/etc/apk/"}) outputSession := podmanTest.Podman([]string{"run", "-v", "/etc/apk/", imgName, "ls", "/etc/apk/"})
outputSession.WaitWithDefaultTimeout() outputSession.WaitWithDefaultTimeout()
Expect(outputSession).Should(Exit(0)) Expect(outputSession).Should(Exit(0))
Expect(outputSession.OutputToString()).To(Equal(baselineOutput)) Expect(outputSession.OutputToString()).To(Equal(baselineOutput))
}) })
It("podman named volume copyup empty directory", func() { It("podman named volume copyup empty directory", func() {
baselineSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", ALPINE, "ls", "/srv"}) baselineSession := podmanTest.Podman([]string{"run", "--rm", ALPINE, "ls", "/srv"})
baselineSession.WaitWithDefaultTimeout() baselineSession.WaitWithDefaultTimeout()
Expect(baselineSession).Should(Exit(0)) Expect(baselineSession).Should(Exit(0))
baselineOutput := baselineSession.OutputToString() baselineOutput := baselineSession.OutputToString()
outputSession := podmanTest.Podman([]string{"run", "-t", "-i", "-v", "/srv", ALPINE, "ls", "/srv"}) outputSession := podmanTest.Podman([]string{"run", "-v", "/srv", ALPINE, "ls", "/srv"})
outputSession.WaitWithDefaultTimeout() outputSession.WaitWithDefaultTimeout()
Expect(outputSession).Should(Exit(0)) Expect(outputSession).Should(Exit(0))
Expect(outputSession.OutputToString()).To(Equal(baselineOutput)) Expect(outputSession.OutputToString()).To(Equal(baselineOutput))
}) })
It("podman named volume copyup of /var", func() { It("podman named volume copyup of /var", func() {
baselineSession := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", fedoraMinimal, "ls", "/var"}) baselineSession := podmanTest.Podman([]string{"run", "--rm", fedoraMinimal, "ls", "/var"})
baselineSession.WaitWithDefaultTimeout() baselineSession.WaitWithDefaultTimeout()
Expect(baselineSession).Should(Exit(0)) Expect(baselineSession).Should(Exit(0))
baselineOutput := baselineSession.OutputToString() baselineOutput := baselineSession.OutputToString()
outputSession := podmanTest.Podman([]string{"run", "-t", "-i", "-v", "/var", fedoraMinimal, "ls", "/var"}) outputSession := podmanTest.Podman([]string{"run", "-v", "/var", fedoraMinimal, "ls", "/var"})
outputSession.WaitWithDefaultTimeout() outputSession.WaitWithDefaultTimeout()
Expect(outputSession).Should(Exit(0)) Expect(outputSession).Should(Exit(0))
Expect(outputSession.OutputToString()).To(Equal(baselineOutput)) Expect(outputSession.OutputToString()).To(Equal(baselineOutput))
}) })
It("podman read-only tmpfs conflict with volume", func() { It("podman read-only tmpfs conflict with volume", func() {
session := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", "--read-only", "-v", "tmp_volume:" + dest, ALPINE, "touch", dest + "/a"}) session := podmanTest.Podman([]string{"run", "--rm", "--read-only", "-v", "tmp_volume:" + dest, ALPINE, "touch", dest + "/a"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
session2 := podmanTest.Podman([]string{"run", "--rm", "-t", "-i", "--read-only", "--tmpfs", dest, ALPINE, "touch", dest + "/a"}) session2 := podmanTest.Podman([]string{"run", "--rm", "--read-only", "--tmpfs", dest, ALPINE, "touch", dest + "/a"})
session2.WaitWithDefaultTimeout() session2.WaitWithDefaultTimeout()
Expect(session2).Should(Exit(0)) Expect(session2).Should(Exit(0))
}) })
@ -623,7 +623,7 @@ RUN sh -c "cd /etc/apk && ln -s ../../testfile"`, ALPINE)
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
defer file.Close() defer file.Close()
runLs := podmanTest.Podman([]string{"run", "-t", "-i", "--rm", "-v", fmt.Sprintf("%v:/etc/ssl", volName), ALPINE, "ls", "-1", "/etc/ssl"}) runLs := podmanTest.Podman([]string{"run", "--rm", "-v", fmt.Sprintf("%v:/etc/ssl", volName), ALPINE, "ls", "-1", "/etc/ssl"})
runLs.WaitWithDefaultTimeout() runLs.WaitWithDefaultTimeout()
Expect(runLs).Should(Exit(0)) Expect(runLs).Should(Exit(0))
outputArr := runLs.OutputToStringArray() outputArr := runLs.OutputToStringArray()
@ -746,7 +746,7 @@ VOLUME /test/`, ALPINE)
It("same volume in multiple places does not deadlock", func() { It("same volume in multiple places does not deadlock", func() {
volName := "testVol1" volName := "testVol1"
session := podmanTest.Podman([]string{"run", "-t", "-i", "-v", fmt.Sprintf("%s:/test1", volName), "-v", fmt.Sprintf("%s:/test2", volName), "--rm", ALPINE, "sh", "-c", "mount | grep /test"}) session := podmanTest.Podman([]string{"run", "-v", fmt.Sprintf("%s:/test1", volName), "-v", fmt.Sprintf("%s:/test2", volName), "--rm", ALPINE, "sh", "-c", "mount | grep /test"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToStringArray()).To(HaveLen(2)) Expect(session.OutputToStringArray()).To(HaveLen(2))
@ -987,7 +987,7 @@ USER testuser`, fedoraMinimal)
Expect(err).ToNot(HaveOccurred()) Expect(err).ToNot(HaveOccurred())
}() }()
run := podmanTest.Podman([]string{"run", "-it", "--security-opt", "label=disable", "-v", "./:" + dest, ALPINE, "ls", dest}) run := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", "./:" + dest, ALPINE, "ls", dest})
run.WaitWithDefaultTimeout() run.WaitWithDefaultTimeout()
Expect(run).Should(Exit(0)) Expect(run).Should(Exit(0))
Expect(run.OutputToString()).Should(ContainSubstring(strings.TrimLeft("/vol/", f.Name()))) Expect(run.OutputToString()).Should(ContainSubstring(strings.TrimLeft("/vol/", f.Name())))

View File

@ -155,7 +155,7 @@ var _ = Describe("Podman start", func() {
}) })
It("podman failed to start with --rm should delete the container", func() { It("podman failed to start with --rm should delete the container", func() {
session := podmanTest.Podman([]string{"create", "--name", "test1", "-it", "--rm", ALPINE, "foo"}) session := podmanTest.Podman([]string{"create", "--name", "test1", "--rm", ALPINE, "foo"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
@ -170,7 +170,7 @@ var _ = Describe("Podman start", func() {
}) })
It("podman failed to start without --rm should NOT delete the container", func() { It("podman failed to start without --rm should NOT delete the container", func() {
session := podmanTest.Podman([]string{"create", "-it", ALPINE, "foo"}) session := podmanTest.Podman([]string{"create", ALPINE, "foo"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))

View File

@ -90,7 +90,7 @@ WantedBy=default.target
started := podmanTest.WaitContainerReady(ctrName, "Reached target multi-user.target - Multi-User System.", 30, 1) started := podmanTest.WaitContainerReady(ctrName, "Reached target multi-user.target - Multi-User System.", 30, 1)
Expect(started).To(BeTrue()) Expect(started).To(BeTrue())
systemctl := podmanTest.Podman([]string{"exec", "-t", "-i", ctrName, "systemctl", "status", "--no-pager"}) systemctl := podmanTest.Podman([]string{"exec", ctrName, "systemctl", "status", "--no-pager"})
systemctl.WaitWithDefaultTimeout() systemctl.WaitWithDefaultTimeout()
Expect(systemctl).Should(Exit(0)) Expect(systemctl).Should(Exit(0))
Expect(systemctl.OutputToString()).To(ContainSubstring("State:")) Expect(systemctl.OutputToString()).To(ContainSubstring("State:"))

View File

@ -55,43 +55,43 @@ var _ = Describe("Podman update", func() {
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
// checking cpu quota from --cpus // checking cpu quota from --cpus
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("500000")) Expect(session.OutputToString()).Should(ContainSubstring("500000"))
// checking cpuset-cpus // checking cpuset-cpus
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/cpuset/cpuset.cpus"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpuset/cpuset.cpus"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(Equal("0")) Expect(session.OutputToString()).Should(Equal("0"))
// checking cpuset-mems // checking cpuset-mems
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/cpuset/cpuset.mems"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpuset/cpuset.mems"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(Equal("0")) Expect(session.OutputToString()).Should(Equal("0"))
// checking memory limit // checking memory limit
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/memory/memory.limit_in_bytes"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/memory/memory.limit_in_bytes"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("1073741824")) Expect(session.OutputToString()).Should(ContainSubstring("1073741824"))
// checking memory-swap // checking memory-swap
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/memory/memory.memsw.limit_in_bytes"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("2147483648")) Expect(session.OutputToString()).Should(ContainSubstring("2147483648"))
// checking cpu-shares // checking cpu-shares
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/cpu/cpu.shares"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu/cpu.shares"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("123")) Expect(session.OutputToString()).Should(ContainSubstring("123"))
// checking pids-limit // checking pids-limit
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/pids/pids.max"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/pids/pids.max"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("123")) Expect(session.OutputToString()).Should(ContainSubstring("123"))
@ -119,7 +119,7 @@ var _ = Describe("Podman update", func() {
ctrID = session.OutputToString() ctrID = session.OutputToString()
// checking pids-limit was not changed after update when not specified as an option // checking pids-limit was not changed after update when not specified as an option
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/pids.max"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/pids.max"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("max")) Expect(session.OutputToString()).Should(ContainSubstring("max"))
@ -158,55 +158,55 @@ var _ = Describe("Podman update", func() {
ctrID = session.OutputToString() ctrID = session.OutputToString()
// checking cpu quota and period // checking cpu quota and period
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/cpu.max"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu.max"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("500000")) Expect(session.OutputToString()).Should(ContainSubstring("500000"))
// checking blkio weight // checking blkio weight
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/io.bfq.weight"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/io.bfq.weight"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("123")) Expect(session.OutputToString()).Should(ContainSubstring("123"))
// checking device-read/write-bps/iops // checking device-read/write-bps/iops
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/io.max"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/io.max"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("rbps=10485760 wbps=10485760 riops=1000 wiops=1000")) Expect(session.OutputToString()).Should(ContainSubstring("rbps=10485760 wbps=10485760 riops=1000 wiops=1000"))
// checking cpuset-cpus // checking cpuset-cpus
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/cpuset.cpus"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpuset.cpus"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(Equal("0")) Expect(session.OutputToString()).Should(Equal("0"))
// checking cpuset-mems // checking cpuset-mems
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/cpuset.mems"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpuset.mems"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(Equal("0")) Expect(session.OutputToString()).Should(Equal("0"))
// checking memory limit // checking memory limit
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/memory.max"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/memory.max"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("1073741824")) Expect(session.OutputToString()).Should(ContainSubstring("1073741824"))
// checking memory-swap // checking memory-swap
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/memory.swap.max"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/memory.swap.max"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("1073741824")) Expect(session.OutputToString()).Should(ContainSubstring("1073741824"))
// checking cpu-shares // checking cpu-shares
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/cpu.weight"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu.weight"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("5")) Expect(session.OutputToString()).Should(ContainSubstring("5"))
// checking pids-limit // checking pids-limit
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/pids.max"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/pids.max"})
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))
Expect(session.OutputToString()).Should(ContainSubstring("123")) Expect(session.OutputToString()).Should(ContainSubstring("123"))
@ -230,9 +230,9 @@ var _ = Describe("Podman update", func() {
ctrID := session.OutputToString() ctrID := session.OutputToString()
if v2, _ := cgroupv2.Enabled(); v2 { if v2, _ := cgroupv2.Enabled(); v2 {
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/cpu.max"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu.max"})
} else { } else {
session = podmanTest.Podman([]string{"exec", "-it", ctrID, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"}) session = podmanTest.Podman([]string{"exec", ctrID, "cat", "/sys/fs/cgroup/cpu/cpu.cfs_quota_us"})
} }
session.WaitWithDefaultTimeout() session.WaitWithDefaultTimeout()
Expect(session).Should(Exit(0)) Expect(session).Should(Exit(0))