summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-08-12 10:29:17 -0400
committerGitHub <noreply@github.com>2020-08-12 10:29:17 -0400
commitac96112d706ac7be682a6a3e218b10affd2ece20 (patch)
tree3d8cbe927cc6cdc0eaa7412df8edf725b911bc71 /test
parent8eaacec150df782c291e9c6046bb0db010dd2f08 (diff)
parentd45bd6e29ab16b9811dfb2e520a49ed7baebda98 (diff)
downloadpodman-ac96112d706ac7be682a6a3e218b10affd2ece20.tar.gz
podman-ac96112d706ac7be682a6a3e218b10affd2ece20.tar.bz2
podman-ac96112d706ac7be682a6a3e218b10affd2ece20.zip
Merge pull request #7267 from zhangguanzhang/check-invalid-network-create
Add parameter verification for api creation network
Diffstat (limited to 'test')
-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 fff3f3b1f..4c032c072 100644
--- a/test/apiv2/35-networks.at
+++ b/test/apiv2/35-networks.at
@@ -3,6 +3,32 @@
# network-related tests
#
-t GET /networks/non-existing-network 404
+t GET networks/non-existing-network 404 \
+ .cause='network not found'
+
+if root; then
+ t POST libpod/networks/create?name=network1 '' 200 \
+ .Filename~.*/network1\\.conflist
+
+ # --data '{"Subnet":{"IP":"10.10.254.0","Mask":[255,255,255,0]}}'
+ t POST libpod/networks/create?name=network2 '"Subnet":{"IP":"10.10.254.0","Mask":[255,255,255,0]}' 200 \
+ .Filename~.*/network2\\.conflist
+
+ # test for empty mask
+ t POST libpod/networks/create '"Subnet":{"IP":"10.10.1.0","Mask":[]}' 500 \
+ .cause~'.*cannot be empty'
+ # test for invalid mask
+ t POST libpod/networks/create '"Subnet":{"IP":"10.10.1.0","Mask":[0,255,255,0]}' 500 \
+ .cause~'.*mask is invalid'
+
+ # clean the network
+ t DELETE libpod/networks/network1 200 \
+ .[0].Name~network1 \
+ .[0].Err=null
+ t DELETE libpod/networks/network2 200 \
+ .[0].Name~network2 \
+ .[0].Err=null
+
+fi
# vim: filetype=sh