summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-12-13 15:56:20 +0100
committerPaul Holzinger <pholzing@redhat.com>2021-12-14 15:23:40 +0100
commit3e9af2029f1f92fbc069f81ba9ca90c090617e9c (patch)
tree2722625080848dd49e91ac60c93b10f5e5cda565 /test
parent535818414c2a6bdcf6434e36c33775ea1a43f1cf (diff)
downloadpodman-3e9af2029f1f92fbc069f81ba9ca90c090617e9c.tar.gz
podman-3e9af2029f1f92fbc069f81ba9ca90c090617e9c.tar.bz2
podman-3e9af2029f1f92fbc069f81ba9ca90c090617e9c.zip
play kube add support for multiple networks
Allow the same --network options for play kube as for podman run/create. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/e2e/play_kube_test.go35
-rw-r--r--test/system/700-play.bats2
2 files changed, 35 insertions, 2 deletions
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 36010704f..f79710ee6 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -2136,6 +2136,41 @@ spec:
}
})
+ It("podman play kube with multiple networks", func() {
+ ctr := getCtr(withImage(ALPINE))
+ pod := getPod(withCtr(ctr))
+ err := generateKubeYaml("pod", pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ net1 := "net1" + stringid.GenerateNonCryptoID()
+ net2 := "net2" + stringid.GenerateNonCryptoID()
+
+ net := podmanTest.Podman([]string{"network", "create", "--subnet", "10.0.11.0/24", net1})
+ net.WaitWithDefaultTimeout()
+ defer podmanTest.removeCNINetwork(net1)
+ Expect(net).Should(Exit(0))
+
+ net = podmanTest.Podman([]string{"network", "create", "--subnet", "10.0.12.0/24", net2})
+ net.WaitWithDefaultTimeout()
+ defer podmanTest.removeCNINetwork(net2)
+ Expect(net).Should(Exit(0))
+
+ ip1 := "10.0.11.5"
+ ip2 := "10.0.12.10"
+
+ kube := podmanTest.Podman([]string{"play", "kube", "--network", net1 + ":ip=" + ip1, "--network", net2 + ":ip=" + ip2, kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ inspect := podmanTest.Podman([]string{"exec", getCtrNameInPod(pod), "ip", "addr"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).Should(Exit(0))
+ Expect(inspect.OutputToString()).To(ContainSubstring(ip1))
+ Expect(inspect.OutputToString()).To(ContainSubstring(ip2))
+ Expect(inspect.OutputToString()).To(ContainSubstring("eth0"))
+ Expect(inspect.OutputToString()).To(ContainSubstring("eth1"))
+ })
+
It("podman play kube test with network portbindings", func() {
ip := "127.0.0.100"
port := "5000"
diff --git a/test/system/700-play.bats b/test/system/700-play.bats
index b77d41920..88c7cad87 100644
--- a/test/system/700-play.bats
+++ b/test/system/700-play.bats
@@ -104,8 +104,6 @@ RELABEL="system_u:object_r:container_file_t:s0"
TESTDIR=$PODMAN_TMPDIR/testdir
mkdir -p $TESTDIR
echo "$testYaml" | sed "s|TESTDIR|${TESTDIR}|g" > $PODMAN_TMPDIR/test.yaml
- run_podman 125 play kube --network bridge $PODMAN_TMPDIR/test.yaml
- is "$output" ".*invalid value passed to --network: bridge or host networking must be configured in YAML" "podman plan-network should fail with --network host"
run_podman 125 play kube --network host $PODMAN_TMPDIR/test.yaml
is "$output" ".*invalid value passed to --network: bridge or host networking must be configured in YAML" "podman plan-network should fail with --network host"
run_podman play kube --network slirp4netns:port_handler=slirp4netns $PODMAN_TMPDIR/test.yaml