aboutsummaryrefslogtreecommitdiff
path: root/test/apiv2
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-03-18 06:32:29 -0700
committerGitHub <noreply@github.com>2021-03-18 06:32:29 -0700
commit629183bd7f0073dfcbfa4d611abc62a9c5711dab (patch)
tree812ebb2c5a6685f1f333ec960365e97b4e91457f /test/apiv2
parent77b3a2df645f2548f7bd2da85bbdb17e4de98310 (diff)
parent8ea02d0b6033b6ffdc68d38f3276410f4e2e8eb9 (diff)
downloadpodman-629183bd7f0073dfcbfa4d611abc62a9c5711dab.tar.gz
podman-629183bd7f0073dfcbfa4d611abc62a9c5711dab.tar.bz2
podman-629183bd7f0073dfcbfa4d611abc62a9c5711dab.zip
Merge pull request #9710 from jmguzik/network-prune-filters-http-api
Network prune filters for http api (compat and libpod)
Diffstat (limited to 'test/apiv2')
-rw-r--r--test/apiv2/35-networks.at28
1 files changed, 27 insertions, 1 deletions
diff --git a/test/apiv2/35-networks.at b/test/apiv2/35-networks.at
index ce7ca628a..6c3a34ece 100644
--- a/test/apiv2/35-networks.at
+++ b/test/apiv2/35-networks.at
@@ -16,6 +16,20 @@ t POST libpod/networks/create?name=network2 \
200 \
.Filename~.*/network2\\.conflist
+# --data '{"Subnet":{"IP":"10.10.133.0","Mask":[255,255,255,0]},"Labels":{"xyz":"val"}}'
+t POST libpod/networks/create?name=network3 \
+ Subnet='{"IP":"10.10.133.0","Mask":[255,255,255,0]}' \
+ Labels='{"xyz":"val"}' \
+ 200 \
+ .Filename~.*/network3\\.conflist
+
+# --data '{"Subnet":{"IP":"10.10.134.0","Mask":[255,255,255,0]},"Labels":{"zaq":"val"}}'
+t POST libpod/networks/create?name=network4 \
+ Subnet='{"IP":"10.10.134.0","Mask":[255,255,255,0]}' \
+ Labels='{"zaq":"val"}' \
+ 200 \
+ .Filename~.*/network4\\.conflist
+
# test for empty mask
t POST libpod/networks/create Subnet='{"IP":"10.10.1.0","Mask":[]}' 500 \
.cause~'.*cannot be empty'
@@ -38,7 +52,7 @@ t GET libpod/networks/network1/json 200 \
t GET networks?filters='{"name":["network1","network2"]}' 200 \
length=2
t GET networks?filters='{"name":["network"]}' 200 \
- length=2
+ length=4
t GET networks?filters='{"label":["abc"]}' 200 \
length=1
# old docker filter type see #9526
@@ -66,6 +80,18 @@ t POST networks/create Name=net3\ IPAM='{"Config":[]}' 201
# network delete docker
t DELETE networks/net3 204
+# Prune networks compat api - bad filter input
+t POST networks/prune?filters='garb1age}' 500 \
+ .cause="invalid character 'g' looking for beginning of value"
+
+# prune networks using filter - compat api
+t POST networks/prune?filters='{"label":["xyz"]}' 200
+t GET networks/json?filters='{"label":["xyz"]}' 404
+
+# prune networks using filter - libpod api
+t POST libpod/networks/prune?filters='{"label":["zaq=val"]}' 200
+t GET libpod/networks/json?filters='{"label":["zaq=val"]}' 200 length=0
+
# clean the network
t DELETE libpod/networks/network1 200 \
.[0].Name~network1 \