diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-12-23 21:35:34 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-23 21:35:34 +0100 |
commit | 61a2262e398125b2bea2a85a7e53256b08558152 (patch) | |
tree | 54d571a74f7d3f3aa64a8932ec01b555f971cb0b /test | |
parent | 3d21da3d11dc9b5944912544609c302c86e56b97 (diff) | |
parent | 14439b986924dd64c465e2f0df12f74e7334298e (diff) | |
download | podman-61a2262e398125b2bea2a85a7e53256b08558152.tar.gz podman-61a2262e398125b2bea2a85a7e53256b08558152.tar.bz2 podman-61a2262e398125b2bea2a85a7e53256b08558152.zip |
Merge pull request #8792 from bziemons/patch-host-network-spec-8790
Set NetNS mode instead of value
Diffstat (limited to 'test')
-rw-r--r-- | test/e2e/play_kube_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index ff3189038..f009e333e 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -62,6 +62,7 @@ metadata: spec: restartPolicy: {{ .RestartPolicy }} hostname: {{ .Hostname }} + hostNetwork: {{ .HostNetwork }} hostAliases: {{ range .HostAliases }} - hostnames: @@ -220,6 +221,7 @@ spec: spec: restartPolicy: {{ .RestartPolicy }} hostname: {{ .Hostname }} + hostNetwork: {{ .HostNetwork }} containers: {{ with .Ctrs }} {{ range . }} @@ -376,6 +378,7 @@ type Pod struct { Name string RestartPolicy string Hostname string + HostNetwork bool HostAliases []HostAlias Ctrs []*Ctr Volumes []*Volume @@ -396,6 +399,7 @@ func getPod(options ...podOption) *Pod { Name: defaultPodName, RestartPolicy: "Never", Hostname: "", + HostNetwork: false, HostAliases: nil, Ctrs: make([]*Ctr, 0), Volumes: make([]*Volume, 0), @@ -464,6 +468,12 @@ func withVolume(v *Volume) podOption { } } +func withHostNetwork() podOption { + return func(pod *Pod) { + pod.HostNetwork = true + } +} + // Deployment describes the options a kube yaml can be configured at deployment level type Deployment struct { Name string @@ -1587,4 +1597,23 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`}) Expect(inspect.ExitCode()).To(Equal(0)) Expect(inspect.OutputToString()).To(Equal("false")) }) + + It("podman play kube test with HostNetwork", func() { + if !strings.Contains(podmanTest.OCIRuntime, "crun") { + Skip("Test only works on crun") + } + + pod := getPod(withHostNetwork()) + err := generateKubeYaml("pod", 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{"inspect", pod.Name, "--format", "{{ .InfraConfig.HostNetwork }}"}) + inspect.WaitWithDefaultTimeout() + Expect(inspect.ExitCode()).To(Equal(0)) + Expect(inspect.OutputToString()).To(Equal("true")) + }) }) |