summaryrefslogtreecommitdiff
path: root/test/e2e/pod_ps_test.go
diff options
context:
space:
mode:
authorPaul Holzinger <paul.holzinger@web.de>2021-01-09 15:54:07 +0100
committerPaul Holzinger <paul.holzinger@web.de>2021-01-09 17:03:32 +0100
commit1242e7b7a612b1dcae0e09a7fd10e266d34cf9e2 (patch)
treee50592f434cfbae3935ea8973fdc6e1b76f6b94e /test/e2e/pod_ps_test.go
parent49db79e735acd2c693762eaff62680cd9a8cb60b (diff)
downloadpodman-1242e7b7a612b1dcae0e09a7fd10e266d34cf9e2.tar.gz
podman-1242e7b7a612b1dcae0e09a7fd10e266d34cf9e2.tar.bz2
podman-1242e7b7a612b1dcae0e09a7fd10e266d34cf9e2.zip
Add network filter for podman ps and pod ps
Allow to filter on the network name or full id. For pod ps it will filter on the infra container networks. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'test/e2e/pod_ps_test.go')
-rw-r--r--test/e2e/pod_ps_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/e2e/pod_ps_test.go b/test/e2e/pod_ps_test.go
index 225da785c..6a740ed09 100644
--- a/test/e2e/pod_ps_test.go
+++ b/test/e2e/pod_ps_test.go
@@ -6,6 +6,7 @@ import (
"sort"
. "github.com/containers/podman/v2/test/utils"
+ "github.com/containers/storage/pkg/stringid"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/onsi/gomega/gexec"
@@ -280,6 +281,30 @@ var _ = Describe("Podman ps", func() {
Expect(session.OutputToString()).To(Not(ContainSubstring(podid3)))
})
+ It("podman pod ps filter network", func() {
+ net := stringid.GenerateNonCryptoID()
+ session := podmanTest.Podman([]string{"network", "create", net})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ defer podmanTest.removeCNINetwork(net)
+
+ session = podmanTest.Podman([]string{"pod", "create", "--network", net})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ podWithNet := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"pod", "create"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ podWithoutNet := session.OutputToString()
+
+ session = podmanTest.Podman([]string{"pod", "ps", "--no-trunc", "--filter", "network=" + net})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(BeZero())
+ Expect(session.OutputToString()).To(ContainSubstring(podWithNet))
+ Expect(session.OutputToString()).To(Not(ContainSubstring(podWithoutNet)))
+ })
+
It("pod no infra should ps", func() {
session := podmanTest.Podman([]string{"pod", "create", "--infra=false"})
session.WaitWithDefaultTimeout()