Skip to content

Commit

Permalink
add e2e test for network with same subnet
Browse files Browse the repository at this point in the history
add e2e test that checks that is not possible to create
different networks with the same subnet, in IPv6 neither
in IPv4

Signed-off-by: Antonio Ojea <[email protected]>
  • Loading branch information
Antonio Ojea committed Nov 10, 2020
1 parent e7a72d7 commit 98d7707
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/e2e/network_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,29 @@ var _ = Describe("Podman network create", func() {
Expect(ncFail).To(ExitWithError())
})

It("podman network create two networks with same subnet should fail", func() {
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.13.0/24", "subnet1"})
nc.WaitWithDefaultTimeout()
Expect(nc.ExitCode()).To(BeZero())
defer podmanTest.removeCNINetwork("subnet1")

ncFail := podmanTest.Podman([]string{"network", "create", "--subnet", "10.11.13.0/24", "subnet2"})
ncFail.WaitWithDefaultTimeout()
Expect(ncFail).To(ExitWithError())
})

It("podman network create two IPv6 networks with same subnet should fail", func() {
SkipIfRootless("FIXME It needs the ip6tables modules loaded")
nc := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:4:4:4::/64", "--ipv6", "subnet1v6"})
nc.WaitWithDefaultTimeout()
Expect(nc.ExitCode()).To(BeZero())
defer podmanTest.removeCNINetwork("subnet1v6")

ncFail := podmanTest.Podman([]string{"network", "create", "--subnet", "fd00:4:4:4:4::/64", "--ipv6", "subnet2v6"})
ncFail.WaitWithDefaultTimeout()
Expect(ncFail).To(ExitWithError())
})

It("podman network create with invalid network name", func() {
nc := podmanTest.Podman([]string{"network", "create", "foo "})
nc.WaitWithDefaultTimeout()
Expand Down

0 comments on commit 98d7707

Please sign in to comment.