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>
This commit is contained in:
Kunal Kushwaha
2020-05-12 05:02:54 +00:00
parent ade20f3323
commit 087fdda199
2 changed files with 44 additions and 0 deletions

View File

@ -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"

View File

@ -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})