summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKunal Kushwaha <kunal.kushwaha@gmail.com>2020-05-12 05:02:54 +0000
committerKunal Kushwaha <kunal.kushwaha@gmail.com>2020-05-20 02:53:47 +0000
commit087fdda199aaef9f1f0ae1d111e60d22a40ed106 (patch)
treed7e9141af67c51cfbb76332f5be8cf3311b384eb
parentade20f332319ff4df3eaf154f44caaae47d69011 (diff)
downloadpodman-087fdda199aaef9f1f0ae1d111e60d22a40ed106.tar.gz
podman-087fdda199aaef9f1f0ae1d111e60d22a40ed106.tar.bz2
podman-087fdda199aaef9f1f0ae1d111e60d22a40ed106.zip
Testcase added for network commands
New testcase for network ls --filter and inspect --format added. Also bash completion options updated. Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
-rw-r--r--completions/bash/podman5
-rw-r--r--test/e2e/network_test.go39
2 files changed, 44 insertions, 0 deletions
diff --git a/completions/bash/podman b/completions/bash/podman
index 5dbd179ce..9baf7901e 100644
--- a/completions/bash/podman
+++ b/completions/bash/podman
@@ -1024,6 +1024,8 @@ _podman_network_inspect() {
local boolean_options="
--help
-h
+ --format
+ -f
"
_complete_ "$options_with_args" "$boolean_options"
@@ -1042,6 +1044,9 @@ _podman_network_ls() {
-h
--quiet
-q
+ --format
+ -f
+ -- filter
"
_complete_ "$options_with_args" "$boolean_options"
diff --git a/test/e2e/network_test.go b/test/e2e/network_test.go
index 8d575d7f9..e293876b9 100644
--- a/test/e2e/network_test.go
+++ b/test/e2e/network_test.go
@@ -105,6 +105,32 @@ var _ = Describe("Podman network", func() {
Expect(session.LineInOutputContains("podman-integrationtest")).To(BeTrue())
})
+ It("podman network list --filter success", func() {
+ // Setup, use uuid to prevent conflict with other tests
+ uuid := stringid.GenerateNonCryptoID()
+ secondPath := filepath.Join(cniPath, fmt.Sprintf("%s.conflist", uuid))
+ writeConf([]byte(secondConf), secondPath)
+ defer removeConf(secondPath)
+
+ session := podmanTest.Podman([]string{"network", "ls", "--filter", "plugin=bridge"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.LineInOutputContains("podman-integrationtest")).To(BeTrue())
+ })
+
+ It("podman network list --filter failure", func() {
+ // Setup, use uuid to prevent conflict with other tests
+ uuid := stringid.GenerateNonCryptoID()
+ secondPath := filepath.Join(cniPath, fmt.Sprintf("%s.conflist", uuid))
+ writeConf([]byte(secondConf), secondPath)
+ defer removeConf(secondPath)
+
+ session := podmanTest.Podman([]string{"network", "ls", "--filter", "plugin=test"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.LineInOutputContains("podman-integrationtest")).To(BeFalse())
+ })
+
It("podman network rm no args", func() {
session := podmanTest.Podman([]string{"network", "rm"})
session.WaitWithDefaultTimeout()
@@ -152,6 +178,19 @@ var _ = Describe("Podman network", func() {
Expect(session.IsJSONOutputValid()).To(BeTrue())
})
+ It("podman network inspect", func() {
+ // Setup, use uuid to prevent conflict with other tests
+ uuid := stringid.GenerateNonCryptoID()
+ secondPath := filepath.Join(cniPath, fmt.Sprintf("%s.conflist", uuid))
+ writeConf([]byte(secondConf), secondPath)
+ defer removeConf(secondPath)
+
+ session := podmanTest.Podman([]string{"network", "inspect", "podman-integrationtest", "--format", "{{.cniVersion}}"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(session.LineInOutputContains("0.3.0")).To(BeTrue())
+ })
+
It("podman inspect container single CNI network", func() {
netName := "testNetSingleCNI"
network := podmanTest.Podman([]string{"network", "create", "--subnet", "10.50.50.0/24", netName})