aboutsummaryrefslogtreecommitdiff
path: root/test/system/500-networking.bats
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-09-25 16:06:07 +0000
committerGitHub <noreply@github.com>2020-09-25 16:06:07 +0000
commitb9d77796c0e011e6337f5c173bb633ebcae863f9 (patch)
tree4080d9269f8ca07b3e079e64dfc1f1fdb3b1e22b /test/system/500-networking.bats
parent2583246a17e40af3a3227f24daeb7b081f1c3d55 (diff)
parentbd3c66fc8151350ad6562959054eddb5508cf028 (diff)
downloadpodman-b9d77796c0e011e6337f5c173bb633ebcae863f9.tar.gz
podman-b9d77796c0e011e6337f5c173bb633ebcae863f9.tar.bz2
podman-b9d77796c0e011e6337f5c173bb633ebcae863f9.zip
Merge pull request #7687 from edsantiago/bats
system tests: new tests
Diffstat (limited to 'test/system/500-networking.bats')
-rw-r--r--test/system/500-networking.bats29
1 files changed, 29 insertions, 0 deletions
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