mirror of
https://github.com/containers/podman.git
synced 2025-05-17 15:18:43 +08:00
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:
@ -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"
|
||||
|
||||
|
@ -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})
|
||||
|
Reference in New Issue
Block a user