summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-01-27 12:16:50 -0500
committerGitHub <noreply@github.com>2022-01-27 12:16:50 -0500
commitbedbc3e6fc2509ffa3b9a64da224fb21cd649284 (patch)
tree1b98f7142724855573d0a1e2976cb2d015ee5fc4 /test
parent5d6b5a03557385e1a0d6d6ecc29522b0101e22dd (diff)
parent6961d912061c81b7a444e7c00163ae240e318c42 (diff)
downloadpodman-bedbc3e6fc2509ffa3b9a64da224fb21cd649284.tar.gz
podman-bedbc3e6fc2509ffa3b9a64da224fb21cd649284.tar.bz2
podman-bedbc3e6fc2509ffa3b9a64da224fb21cd649284.zip
Merge pull request #13042 from Luap99/subnets
network create: allow multiple subnets
Diffstat (limited to 'test')
-rw-r--r--test/e2e/network_create_test.go78
1 files changed, 78 insertions, 0 deletions
diff --git a/test/e2e/network_create_test.go b/test/e2e/network_create_test.go
index ade78a308..4a8a24ad7 100644
--- a/test/e2e/network_create_test.go
+++ b/test/e2e/network_create_test.go
@@ -356,4 +356,82 @@ var _ = Describe("Podman network create", func() {
}
})
+ It("podman network create with multiple subnets", func() {
+ name := "subnets-" + stringid.GenerateNonCryptoID()
+ subnet1 := "10.10.0.0/24"
+ subnet2 := "10.10.1.0/24"
+ nc := podmanTest.Podman([]string{"network", "create", "--subnet", subnet1, "--subnet", subnet2, name})
+ nc.WaitWithDefaultTimeout()
+ defer podmanTest.removeCNINetwork(name)
+ Expect(nc).To(Exit(0))
+ Expect(nc.OutputToString()).To(Equal(name))
+
+ inspect := podmanTest.Podman([]string{"network", "inspect", name})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).To(Exit(0))
+ Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet1))
+ Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet2))
+ Expect(inspect.OutputToString()).To(ContainSubstring(`"ipv6_enabled": false`))
+ })
+
+ It("podman network create with multiple subnets dual stack", func() {
+ name := "subnets-" + stringid.GenerateNonCryptoID()
+ subnet1 := "10.10.2.0/24"
+ subnet2 := "fd52:2a5a:747e:3acd::/64"
+ nc := podmanTest.Podman([]string{"network", "create", "--subnet", subnet1, "--subnet", subnet2, name})
+ nc.WaitWithDefaultTimeout()
+ defer podmanTest.removeCNINetwork(name)
+ Expect(nc).To(Exit(0))
+ Expect(nc.OutputToString()).To(Equal(name))
+
+ inspect := podmanTest.Podman([]string{"network", "inspect", name})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).To(Exit(0))
+ Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet1))
+ Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet2))
+ Expect(inspect.OutputToString()).To(ContainSubstring(`"ipv6_enabled": true`))
+ })
+
+ It("podman network create with multiple subnets dual stack with gateway and range", func() {
+ name := "subnets-" + stringid.GenerateNonCryptoID()
+ subnet1 := "10.10.3.0/24"
+ gw1 := "10.10.3.10"
+ range1 := "10.10.3.0/26"
+ subnet2 := "fd52:2a5a:747e:3acd::/64"
+ gw2 := "fd52:2a5a:747e:3acd::10"
+ nc := podmanTest.Podman([]string{"network", "create", "--subnet", subnet1, "--gateway", gw1, "--ip-range", range1, "--subnet", subnet2, "--gateway", gw2, name})
+ nc.WaitWithDefaultTimeout()
+ defer podmanTest.removeCNINetwork(name)
+ Expect(nc).To(Exit(0))
+ Expect(nc.OutputToString()).To(Equal(name))
+
+ inspect := podmanTest.Podman([]string{"network", "inspect", name})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).To(Exit(0))
+ Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet1))
+ Expect(inspect.OutputToString()).To(ContainSubstring(`"gateway": "` + gw1))
+ Expect(inspect.OutputToString()).To(ContainSubstring(`"start_ip": "10.10.3.1",`))
+ Expect(inspect.OutputToString()).To(ContainSubstring(`"end_ip": "10.10.3.63"`))
+ Expect(inspect.OutputToString()).To(ContainSubstring(`"subnet": "` + subnet2))
+ Expect(inspect.OutputToString()).To(ContainSubstring(`"gateway": "` + gw2))
+ Expect(inspect.OutputToString()).To(ContainSubstring(`"ipv6_enabled": true`))
+ })
+
+ It("podman network create invalid options with multiple subnets", func() {
+ name := "subnets-" + stringid.GenerateNonCryptoID()
+ subnet1 := "10.10.3.0/24"
+ gw1 := "10.10.3.10"
+ gw2 := "fd52:2a5a:747e:3acd::10"
+ nc := podmanTest.Podman([]string{"network", "create", "--subnet", subnet1, "--gateway", gw1, "--gateway", gw2, name})
+ nc.WaitWithDefaultTimeout()
+ Expect(nc).To(Exit(125))
+ Expect(nc.ErrorToString()).To(Equal("Error: cannot set more gateways than subnets"))
+
+ range1 := "10.10.3.0/26"
+ range2 := "10.10.3.0/28"
+ nc = podmanTest.Podman([]string{"network", "create", "--subnet", subnet1, "--ip-range", range1, "--ip-range", range2, name})
+ nc.WaitWithDefaultTimeout()
+ Expect(nc).To(Exit(125))
+ Expect(nc.ErrorToString()).To(Equal("Error: cannot set more ranges than subnets"))
+ })
})