summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorzhangguanzhang <zhangguanzhang@qq.com>2020-08-27 15:45:04 +0800
committerzhangguanzhang <zhangguanzhang@qq.com>2020-08-27 17:32:51 +0800
commita2bb7bd36b22f45dbccabbab9dcca83abfda1682 (patch)
tree76919e0667f2c65ceeb6da30398b293f580d2d41 /test/e2e
parentf99954c7ca4428e501676fa47a63b5cecadd9454 (diff)
downloadpodman-a2bb7bd36b22f45dbccabbab9dcca83abfda1682.tar.gz
podman-a2bb7bd36b22f45dbccabbab9dcca83abfda1682.tar.bz2
podman-a2bb7bd36b22f45dbccabbab9dcca83abfda1682.zip
fix podman generate kube with HostAliases
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/generate_kube_test.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/e2e/generate_kube_test.go b/test/e2e/generate_kube_test.go
index 1ec8d51c1..3c3fb5a4d 100644
--- a/test/e2e/generate_kube_test.go
+++ b/test/e2e/generate_kube_test.go
@@ -151,6 +151,38 @@ var _ = Describe("Podman generate kube", func() {
Expect(numContainers).To(Equal(1))
})
+ It("podman generate kube on pod with hostAliases", func() {
+ podName := "testHost"
+ testIP := "127.0.0.1"
+ podSession := podmanTest.Podman([]string{"pod", "create", "--name", podName,
+ "--add-host", "test1.podman.io" + ":" + testIP,
+ "--add-host", "test2.podman.io" + ":" + testIP,
+ })
+ podSession.WaitWithDefaultTimeout()
+ Expect(podSession.ExitCode()).To(Equal(0))
+
+ ctr1Name := "ctr1"
+ ctr1Session := podmanTest.Podman([]string{"create", "--name", ctr1Name, "--pod", podName, ALPINE, "top"})
+ ctr1Session.WaitWithDefaultTimeout()
+ Expect(ctr1Session.ExitCode()).To(Equal(0))
+
+ ctr2Name := "ctr2"
+ ctr2Session := podmanTest.Podman([]string{"create", "--name", ctr2Name, "--pod", podName, ALPINE, "top"})
+ ctr2Session.WaitWithDefaultTimeout()
+ Expect(ctr2Session.ExitCode()).To(Equal(0))
+
+ kube := podmanTest.Podman([]string{"generate", "kube", podName})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ pod := new(v1.Pod)
+ err := yaml.Unmarshal(kube.Out.Contents(), pod)
+ Expect(err).To(BeNil())
+ Expect(len(pod.Spec.HostAliases)).To(Equal(2))
+ Expect(pod.Spec.HostAliases[0].IP).To(Equal(testIP))
+ Expect(pod.Spec.HostAliases[1].IP).To(Equal(testIP))
+ })
+
It("podman generate service kube on pod", func() {
_, rc, _ := podmanTest.CreatePod("toppod")
Expect(rc).To(Equal(0))