diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2021-01-09 15:54:07 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2021-01-09 17:03:32 +0100 |
commit | 1242e7b7a612b1dcae0e09a7fd10e266d34cf9e2 (patch) | |
tree | e50592f434cfbae3935ea8973fdc6e1b76f6b94e /test/e2e/ps_test.go | |
parent | 49db79e735acd2c693762eaff62680cd9a8cb60b (diff) | |
download | podman-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/ps_test.go')
-rw-r--r-- | test/e2e/ps_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go index 0c5d817ba..0d2bed485 100644 --- a/test/e2e/ps_test.go +++ b/test/e2e/ps_test.go @@ -8,6 +8,7 @@ import ( "strings" . "github.com/containers/podman/v2/test/utils" + "github.com/containers/storage/pkg/stringid" "github.com/docker/go-units" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -724,4 +725,28 @@ var _ = Describe("Podman ps", func() { }) + It("podman 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{"create", "--network", net, ALPINE}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(BeZero()) + ctrWithNet := session.OutputToString() + + session = podmanTest.Podman([]string{"create", ALPINE}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(BeZero()) + ctrWithoutNet := session.OutputToString() + + session = podmanTest.Podman([]string{"ps", "--all", "--no-trunc", "--filter", "network=" + net}) + session.WaitWithDefaultTimeout() + Expect(session.ExitCode()).To(BeZero()) + Expect(session.OutputToString()).To(ContainSubstring(ctrWithNet)) + Expect(session.OutputToString()).To(Not(ContainSubstring(ctrWithoutNet))) + }) + }) |