summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-09-16 11:01:52 +0200
committerPaul Holzinger <pholzing@redhat.com>2021-09-16 11:01:52 +0200
commit5c7935057c34cbdb27be3a584d35bff3fcd81202 (patch)
tree6fd4ff71cc95308d655a0d52bf01affae13f2c92 /test
parent9119a578e782b92bd344f093f5491c318bc20d69 (diff)
downloadpodman-5c7935057c34cbdb27be3a584d35bff3fcd81202.tar.gz
podman-5c7935057c34cbdb27be3a584d35bff3fcd81202.tar.bz2
podman-5c7935057c34cbdb27be3a584d35bff3fcd81202.zip
Do not allow network modes to be used as network names
`podman network create` should not allow users to create networks with a name which is already used for a network mode in `podman run --network`. Fixes #11448 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/network_create_test.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go
index d419a701d..ae9f112b5 100644
--- a/test/e2e/network_create_test.go
+++ b/test/e2e/network_create_test.go
@@ -343,4 +343,13 @@ var _ = Describe("Podman network create", func() {
Expect(nc.OutputToString()).ToNot(ContainSubstring("dnsname"))
})
+ It("podman network create with invalid name", func() {
+ for _, name := range []string{"none", "host", "bridge", "private", "slirp4netns", "container", "ns"} {
+ nc := podmanTest.Podman([]string{"network", "create", name})
+ nc.WaitWithDefaultTimeout()
+ Expect(nc).To(Exit(125))
+ Expect(nc.ErrorToString()).To(ContainSubstring("cannot create network with name %q because it conflicts with a valid network mode", name))
+ }
+ })
+
})