summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-11-12 19:59:44 +0100
committerGitHub <noreply@github.com>2021-11-12 19:59:44 +0100
commit78bc2390f4d03ef4b179b129c69b5332c30692ce (patch)
treec85bd4dc36ca99f2f923e28000477c51547ac693 /test
parent0aecacb8655d65cb55ec09a9629a358236e6af73 (diff)
parent164c42b4857c63fa9750599a9242709ed18c57db (diff)
downloadpodman-78bc2390f4d03ef4b179b129c69b5332c30692ce.tar.gz
podman-78bc2390f4d03ef4b179b129c69b5332c30692ce.tar.bz2
podman-78bc2390f4d03ef4b179b129c69b5332c30692ce.zip
Merge pull request #12271 from Luap99/play-kube-net
Fix network mode in play kube
Diffstat (limited to 'test')
-rw-r--r--test/e2e/config/containers-netns2.conf3
-rw-r--r--test/e2e/play_kube_test.go28
2 files changed, 31 insertions, 0 deletions
diff --git a/test/e2e/config/containers-netns2.conf b/test/e2e/config/containers-netns2.conf
new file mode 100644
index 000000000..1ffd100f5
--- /dev/null
+++ b/test/e2e/config/containers-netns2.conf
@@ -0,0 +1,3 @@
+[containers]
+
+netns = "bridge"
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index b0b927445..64b46756f 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -2786,6 +2786,34 @@ invalid kube kind
Expect(exists).To(Exit(0))
})
+ It("podman play kube use network mode from config", func() {
+ confPath, err := filepath.Abs("config/containers-netns2.conf")
+ Expect(err).ToNot(HaveOccurred())
+ os.Setenv("CONTAINERS_CONF", confPath)
+ defer os.Unsetenv("CONTAINERS_CONF")
+ if IsRemote() {
+ podmanTest.RestartRemoteService()
+ }
+
+ pod := getPod()
+ err = generateKubeYaml("pod", pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube).Should(Exit(0))
+
+ podInspect := podmanTest.Podman([]string{"pod", "inspect", pod.Name, "--format", "{{.InfraContainerID}}"})
+ podInspect.WaitWithDefaultTimeout()
+ Expect(podInspect).To(Exit(0))
+ infraID := podInspect.OutputToString()
+
+ inspect := podmanTest.Podman([]string{"inspect", "--format", "{{.HostConfig.NetworkMode}}", infraID})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect).To(Exit(0))
+ Expect(inspect.OutputToString()).To(Equal("bridge"))
+ })
+
It("podman play kube replace", func() {
pod := getPod()
err := generateKubeYaml("pod", pod, kubeYaml)