summaryrefslogtreecommitdiff
path: root/test/e2e/pod_ps_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/pod_ps_test.go')
-rw-r--r--test/e2e/pod_ps_test.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go
index 6a740ed09..9f63c1d5d 100644
--- a/test/e2e/pod_ps_test.go
+++ b/test/e2e/pod_ps_test.go
@@ -305,6 +305,45 @@ var _ = Describe("Podman ps", func() {
Expect(session.OutputToString()).To(Not(ContainSubstring(podWithoutNet)))
})
+ It("podman pod ps --format networks", func() {
+ session := podmanTest.Podman([]string{"pod", "create"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+
+ session = podmanTest.Podman([]string{"pod", "ps", "--format", "{{ .Networks }}"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ if isRootless() {
+ // rootless container don't have a network by default
+ Expect(session.OutputToString()).To(Equal(""))
+ } else {
+ // default network name is podman
+ Expect(session.OutputToString()).To(Equal("podman"))
+ }
+
+ net1 := stringid.GenerateNonCryptoID()
+ session = podmanTest.Podman([]string{"network", "create", net1})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(net1)
+ net2 := stringid.GenerateNonCryptoID()
+ session = podmanTest.Podman([]string{"network", "create", net2})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(net2)
+
+ session = podmanTest.Podman([]string{"pod", "create", "--network", net1 + "," + net2})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ pid := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"pod", "ps", "--format", "{{ .Networks }}", "--filter", "id=" + pid})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ // the output is not deterministic so check both possible orders
+ Expect(session.OutputToString()).To(Or(Equal(net1+","+net2), Equal(net2+","+net1)))
+ })
+
It("pod no infra should ps", func() {
session := podmanTest.Podman([]string{"pod", "create", "--infra=false"})
session.WaitWithDefaultTimeout()