From bd3c66fc8151350ad6562959054eddb5508cf028 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Wed, 16 Sep 2020 10:06:33 -0600 Subject: system tests: new tests - podman network create: new test - podman pull by-sha + podman images -a (#7651) - podman image mount: new test - podman pod: --infra-image and --infra-command (#7167) For convenience and robustness, build a new testimage containing a custom file /home/podman/testimage-id with contents YYYYMMDD (same as image tag). The image-mount test checks that this file exists and has the desired content. New testimage also includes a dummy 'pause' executable, for testing pod infra. Updates from testimage:20200902 to :20200917 Signed-off-by: Ed Santiago --- test/system/500-networking.bats | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'test/system/500-networking.bats') diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats index 39de8ad54..d2454fbf4 100644 --- a/test/system/500-networking.bats +++ b/test/system/500-networking.bats @@ -80,4 +80,33 @@ load helpers run_podman rm $cid } +# "network create" now works rootless, with the help of a special container +@test "podman network create" { + local mynetname=testnet-$(random_string 10) + local mysubnet=$(random_rfc1918_subnet) + + run_podman network create --subnet "${mysubnet}.0/24" $mynetname + is "$output" ".*/cni/net.d/$mynetname.conflist" "output of 'network create'" + + # WARNING: this pulls a ~100MB image from quay.io, hence is slow/flaky + run_podman run --rm --network $mynetname $IMAGE ip a + is "$output" ".* inet ${mysubnet}\.2/24 brd ${mysubnet}\.255 " \ + "sdfsdf" + + # Cannot create network with the same name + run_podman 125 network create $mynetname + is "$output" "Error: the network name $mynetname is already used" \ + "Trying to create an already-existing network" + + run_podman network rm $mynetname + run_podman 125 network rm $mynetname + + # rootless CNI leaves behind an image pulled by SHA, hence with no tag. + # Remove it if present; we can only remove it by ID. + run_podman images --format '{{.Id}}' rootless-cni-infra + if [ -n "$output" ]; then + run_podman rmi $output + fi +} + # vim: filetype=sh -- cgit v1.2.3-54-g00ecf