summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-04-23 09:22:44 -0400
committerGitHub <noreply@github.com>2021-04-23 09:22:44 -0400
commitfeac25f722284456fb3c065474f0e144a5e26982 (patch)
tree933451aa5c59e7ce9ac7e0cae55008695d2c7c5e /test
parentafdea0dccd06a907d04596375e056134dc4f5b33 (diff)
parentca4f6ec1dbdfd06f3d403eda70dbb2eff3824888 (diff)
downloadpodman-feac25f722284456fb3c065474f0e144a5e26982.tar.gz
podman-feac25f722284456fb3c065474f0e144a5e26982.tar.bz2
podman-feac25f722284456fb3c065474f0e144a5e26982.zip
Merge pull request #10122 from Luap99/fix-10110
Parse slirp4netns net options with compat api
Diffstat (limited to 'test')
-rw-r--r--test/compose/slirp4netns_opts/docker-compose.yml5
-rw-r--r--test/compose/slirp4netns_opts/setup.sh8
-rw-r--r--test/compose/slirp4netns_opts/teardown.sh4
-rw-r--r--test/compose/slirp4netns_opts/tests.sh6
4 files changed, 23 insertions, 0 deletions
diff --git a/test/compose/slirp4netns_opts/docker-compose.yml b/test/compose/slirp4netns_opts/docker-compose.yml
new file mode 100644
index 000000000..dcdcae04c
--- /dev/null
+++ b/test/compose/slirp4netns_opts/docker-compose.yml
@@ -0,0 +1,5 @@
+services:
+ alpine:
+ image: alpine
+ network_mode: "slirp4netns:allow_host_loopback=true"
+ command: sh -c "echo teststring | nc 10.0.2.2 5001"
diff --git a/test/compose/slirp4netns_opts/setup.sh b/test/compose/slirp4netns_opts/setup.sh
new file mode 100644
index 000000000..35bbf7c70
--- /dev/null
+++ b/test/compose/slirp4netns_opts/setup.sh
@@ -0,0 +1,8 @@
+# -*- bash -*-
+
+# create tempfile to store nc output
+OUTFILE=$(mktemp)
+# listen on a port, the container will try to connect to it
+nc -l 5001 > $OUTFILE &
+
+nc_pid=$!
diff --git a/test/compose/slirp4netns_opts/teardown.sh b/test/compose/slirp4netns_opts/teardown.sh
new file mode 100644
index 000000000..656724363
--- /dev/null
+++ b/test/compose/slirp4netns_opts/teardown.sh
@@ -0,0 +1,4 @@
+# -*- bash -*-
+
+kill $nc_pid &> /dev/null
+rm -f $OUTFILE
diff --git a/test/compose/slirp4netns_opts/tests.sh b/test/compose/slirp4netns_opts/tests.sh
new file mode 100644
index 000000000..1efce45c4
--- /dev/null
+++ b/test/compose/slirp4netns_opts/tests.sh
@@ -0,0 +1,6 @@
+# -*- bash -*-
+
+output="$(cat $OUTFILE)"
+expected="teststring"
+
+is "$output" "$expected" "$testname : nc received teststring"