From f18ccbcc0f70c23a6b854130395d9a940383290b Mon Sep 17 00:00:00 2001
From: Paul Holzinger <pholzing@redhat.com>
Date: Tue, 7 Sep 2021 18:24:22 +0200
Subject: fix play kube --network options

Commit 092902b45555 introduced advanced network options for podman play
kube. However this never worked because it unconditionally set the
network mode to bridge after it parsed the network option.

Added a test to ensure the correct mode is set.

Truly fixes #10807

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
---
 test/system/700-play.bats | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'test/system')

diff --git a/test/system/700-play.bats b/test/system/700-play.bats
index 7f35877aa..2b05cdd84 100644
--- a/test/system/700-play.bats
+++ b/test/system/700-play.bats
@@ -98,6 +98,16 @@ RELABEL="system_u:object_r:container_file_t:s0"
     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
+    run_podman pod inspect --format {{.InfraContainerID}} "${lines[1]}"
+    infraID="$output"
+    run_podman container inspect --format "{{.HostConfig.NetworkMode}}" $infraID
+    is "$output" "slirp4netns" "network mode slirp4netns is set for the container"
+    run_podman pod rm -f test_pod
+    run_podman play kube --network none $PODMAN_TMPDIR/test.yaml
+    run_podman pod inspect --format {{.InfraContainerID}} "${lines[1]}"
+    infraID="$output"
+    run_podman container inspect --format "{{.HostConfig.NetworkMode}}" $infraID
+    is "$output" "none" "network mode none is set for the container"
     run_podman pod rm -f test_pod
 }
 
-- 
cgit v1.2.3-54-g00ecf