From 99ddf512aae2aec633b8d2ee7f40c0f6d88df73c Mon Sep 17 00:00:00 2001 From: alsadi Date: Thu, 7 Mar 2019 09:06:02 +0200 Subject: add test to cover networking Signed-off-by: alsadi --- test/test_podman_baseline.sh | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'test/test_podman_baseline.sh') diff --git a/test/test_podman_baseline.sh b/test/test_podman_baseline.sh index 27c0c9178..8c4e5a86f 100755 --- a/test/test_podman_baseline.sh +++ b/test/test_podman_baseline.sh @@ -78,17 +78,25 @@ echo $image ######## # Run container and display contents in /etc ######## -podman run $image ls -alF /etc +podman run --rm $image ls -alF /etc ######## -# Run Java in the container - should ERROR but never stop +# Test networking, bind mounting a file, stdin/stdout redirect ######## -podman run $image java 2>&1 || echo $? - -######## -# Clean out containers -######## -podman rm --all +txt1="Hello, Podman" +echo "$txt" > /tmp/hello.txt +podman run -d --name myweb -p 8080:80 -w /var/www -v /tmp/hello.txt:/var/www/index.txt busybox httpd -f -p 80 +echo $txt | podman exec -i myweb sh -c "cat > /var/www/index2.txt" +txt2=$( podman exec myweb cat /var/www/index2.txt ) +[ "x$txt1"=="x$txt2" ] && echo "PASS" +txt2=$( podman run --rm --net host busybox wget -qO - http://localhost:8080/index.txt ) +[ "x$txt1"=="x$txt2" ] && echo "PASS" +txt2=$( podman run --rm --net host busybox wget -qO - http://localhost:8080/index2.txt ) +[ "x$txt1"=="x$txt2" ] && echo "PASS" +# poadman run --rm --net container:myweb --add-host myweb:127.0.0.1 busybox wget -qO - http://myweb/index.txt +rm /tmp/hello.txt +podman stop myweb +podman rm myweb ######## # pull and run many containers in parallel, test locks ..etc. @@ -136,6 +144,16 @@ count=$( podman ps -q | wc -l ) [ "x$count" == "x0" ] || { echo "was expecting 0 running containers"; exit -1; } +######## +# Run Java in the container - should ERROR but never stop +######## +podman run $image java 2>&1 || echo $? + +######## +# Clean out containers +######## +podman rm --all + ######## # Install java onto the container, commit it, then run it showing java usage ######## -- cgit v1.2.3-54-g00ecf