summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorflouthoc <flouthoc.git@gmail.com>2021-07-29 16:25:18 +0530
committerflouthoc <flouthoc.git@gmail.com>2021-07-30 19:31:05 +0530
commit2a484e782a23ad67c98e22121fde2b83b4072d1a (patch)
tree4691b5c19020ec9281bda7e58dee88e6d63d753f /test
parentf17b810279fd04c3d574e8d3dcc1878d50083a68 (diff)
downloadpodman-2a484e782a23ad67c98e22121fde2b83b4072d1a.tar.gz
podman-2a484e782a23ad67c98e22121fde2b83b4072d1a.tar.bz2
podman-2a484e782a23ad67c98e22121fde2b83b4072d1a.zip
ps: support the container notation for ps --filter network=...
Signed-off-by: flouthoc <flouthoc.git@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/ps_test.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index e27ff27a4..aeb88e481 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -172,6 +172,43 @@ var _ = Describe("Podman ps", func() {
Expect(fullCid).To(Equal(result.OutputToStringArray()[0]))
})
+ It("podman ps --filter network=container:<name>", func() {
+ ctrAlpha := "alpha"
+ container := podmanTest.Podman([]string{"run", "-dt", "--name", ctrAlpha, ALPINE, "top"})
+ container.WaitWithDefaultTimeout()
+ Expect(container).Should(Exit(0))
+
+ ctrBravo := "bravo"
+ containerBravo := podmanTest.Podman([]string{"run", "-dt", "--network", "container:alpha", "--name", ctrBravo, ALPINE, "top"})
+ containerBravo.WaitWithDefaultTimeout()
+ Expect(containerBravo).Should(Exit(0))
+
+ result := podmanTest.Podman([]string{"ps", "-a", "--format", "table {{.Names}}", "--filter", "network=container:alpha"})
+ result.WaitWithDefaultTimeout()
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+ Expect(result.OutputToString()).To(ContainSubstring("bravo"))
+ })
+
+ It("podman ps --filter network=container:<id>", func() {
+ ctrAlpha := "first"
+ container := podmanTest.Podman([]string{"run", "-dt", "--name", ctrAlpha, ALPINE, "top"})
+ container.WaitWithDefaultTimeout()
+ cid := container.OutputToString()
+ Expect(container).Should(Exit(0))
+
+ ctrBravo := "second"
+ containerBravo := podmanTest.Podman([]string{"run", "-dt", "--network", "container:" + cid, "--name", ctrBravo, ALPINE, "top"})
+ containerBravo.WaitWithDefaultTimeout()
+ Expect(containerBravo).Should(Exit(0))
+
+ result := podmanTest.Podman([]string{"ps", "-a", "--format", "table {{.Names}}", "--filter", "network=container:" + cid})
+ result.WaitWithDefaultTimeout()
+ result.WaitWithDefaultTimeout()
+ Expect(result).Should(Exit(0))
+ Expect(result.OutputToString()).To(ContainSubstring("second"))
+ })
+
It("podman ps namespace flag", func() {
_, ec, _ := podmanTest.RunLsContainer("")
Expect(ec).To(Equal(0))