summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorAshley Cui <acui@redhat.com>2020-07-22 13:58:54 -0400
committerAshley Cui <acui@redhat.com>2020-07-22 14:05:17 -0400
commit80f57acc036542cfd19bf19ca596b739be71fd75 (patch)
tree4a6893ab9f74dcddbc566e2d55cfc91d61f546f9 /test/e2e
parent80add2902cf3561d2c9f91dc045076519cd297d5 (diff)
downloadpodman-80f57acc036542cfd19bf19ca596b739be71fd75.tar.gz
podman-80f57acc036542cfd19bf19ca596b739be71fd75.tar.bz2
podman-80f57acc036542cfd19bf19ca596b739be71fd75.zip
Publish IP from YAML (podman play kube)
podman play kube didn't set host ip correctly from YAML Signed-off-by: Ashley Cui <acui@redhat.com>
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/play_kube_test.go35
1 files changed, 34 insertions, 1 deletions
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 4b68f6232..458bd4f4d 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -87,6 +87,11 @@ spec:
{{ end }}
privileged: false
readOnlyRootFilesystem: false
+ ports:
+ - containerPort: {{ .Port }}
+ hostIP: {{ .HostIP }}
+ hostPort: {{ .Port }}
+ protocol: TCP
workingDir: /
{{ end }}
{{ end }}
@@ -338,12 +343,14 @@ type Ctr struct {
CapAdd []string
CapDrop []string
PullPolicy string
+ HostIP string
+ Port string
}
// getCtr takes a list of ctrOptions and returns a Ctr with sane defaults
// and the configured options
func getCtr(options ...ctrOption) *Ctr {
- c := Ctr{defaultCtrName, defaultCtrImage, defaultCtrCmd, defaultCtrArg, true, false, nil, nil, ""}
+ c := Ctr{defaultCtrName, defaultCtrImage, defaultCtrCmd, defaultCtrArg, true, false, nil, nil, "", "", ""}
for _, option := range options {
option(&c)
}
@@ -396,6 +403,13 @@ func withPullPolicy(policy string) ctrOption {
}
}
+func withHostIP(ip string, port string) ctrOption {
+ return func(c *Ctr) {
+ c.HostIP = ip
+ c.Port = port
+ }
+}
+
func getCtrNameInPod(pod *Pod) string {
return fmt.Sprintf("%s-%s", pod.Name, defaultCtrName)
}
@@ -815,4 +829,23 @@ spec:
Expect(inspect.OutputToString()).To(ContainSubstring(correctCmd))
}
})
+
+ It("podman play kube test with network portbindings", func() {
+ ip := "127.0.0.100"
+ port := "5000"
+ ctr := getCtr(withHostIP(ip, port), withImage(BB))
+
+ pod := getPod(withCtr(ctr))
+ err := generatePodKubeYaml(pod, kubeYaml)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ inspect := podmanTest.Podman([]string{"port", getCtrNameInPod(pod)})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect.OutputToString()).To(Equal("5000/tcp -> 127.0.0.100:5000"))
+ })
})