diff options
Diffstat (limited to 'test/apiv2')
-rw-r--r-- | test/apiv2/20-containers.at | 4 | ||||
-rw-r--r-- | test/apiv2/30-volumes.at | 35 | ||||
-rw-r--r-- | test/apiv2/35-networks.at | 69 | ||||
-rw-r--r-- | test/apiv2/45-system.at | 8 | ||||
-rw-r--r-- | test/apiv2/50-secrets.at | 2 | ||||
-rwxr-xr-x | test/apiv2/test-apiv2 | 7 |
6 files changed, 60 insertions, 65 deletions
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index a99e9a184..641c2adc3 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -206,9 +206,9 @@ t GET 'containers/json?limit=0&all=1' 200 \ t GET containers/json?limit=2 200 length=2 # Filter with two ids should return both container -t GET "containers/json?filters=%7B%22id%22%3A%5B%22${cid}%22%2C%22${cid_top}%22%5D%7D&all=1" 200 length=2 +t GET containers/json?filters='{"id":["'${cid}'","'${cid_top}'"]}&all=1' 200 length=2 # Filter with two ids and status running should return only 1 container -t GET "containers/json?filters=%7B%22id%22%3A%5B%22${cid}%22%2C%22${cid_top}%22%5D%2C%22status%22%3A%5B%22running%22%5D%7D&all=1" 200 \ +t GET containers/json?filters='{"id":["'${cid}'","'${cid_top}'"],"status":["running"]}&all=1' 200 \ length=1 \ .[0].Id=${cid_top} diff --git a/test/apiv2/30-volumes.at b/test/apiv2/30-volumes.at index b38810039..cf4b3d3ea 100644 --- a/test/apiv2/30-volumes.at +++ b/test/apiv2/30-volumes.at @@ -45,18 +45,17 @@ t GET libpod/volumes/json 200 \ .[0].Name~.* \ .[0].Mountpoint~.* \ .[0].CreatedAt~[0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}.* -# -G --data-urlencode 'filters={"name":["foo1"]}' -t GET libpod/volumes/json?filters=%7B%22name%22%3A%5B%22foo1%22%5D%7D 200 length=1 .[0].Name=foo1 -# -G --data-urlencode 'filters={"name":["foo1","foo2"]}' -t GET libpod/volumes/json?filters=%7B%22name%22%3A%20%5B%22foo1%22%2C%20%22foo2%22%5D%7D 200 length=2 .[0].Name=foo1 .[1].Name=foo2 -# -G --data-urlencode 'filters={"name":["nonexistent"]}' -t GET libpod/volumes/json?filters=%7B%22name%22%3A%5B%22nonexistent%22%5D%7D 200 length=0 -# -G --data-urlencode 'filters={"label":["testlabel"]}' -t GET libpod/volumes/json?filters=%7B%22label%22:%5B%22testlabel%22%5D%7D 200 length=2 -# -G --data-urlencode 'filters={"label":["testlabel=testonly"]}' -t GET libpod/volumes/json?filters=%7B%22label%22:%5B%22testlabel=testonly%22%5D%7D 200 length=1 -# -G --data-urlencode 'filters={"label":["testlabel1=testonly"]}' -t GET libpod/volumes/json?filters=%7B%22label%22:%5B%22testlabel1=testonly%22%5D%7D 200 length=1 +t GET libpod/volumes/json?filters='{"name":["foo1"]}' 200 \ + length=1 \ + .[0].Name=foo1 +t GET libpod/volumes/json?filters='{"name":%20["foo1",%20"foo2"]}' 200 \ + length=2 \ + .[0].Name=foo1 \ + .[1].Name=foo2 +t GET libpod/volumes/json?filters='{"name":["nonexistent"]}' 200 length=0 +t GET libpod/volumes/json?filters='{"label":["testlabel"]}' 200 length=2 +t GET libpod/volumes/json?filters='{"label":["testlabel=testonly"]}' 200 length=1 +t GET libpod/volumes/json?filters='{"label":["testlabel1=testonly"]}' 200 length=1 ## inspect volume t GET libpod/volumes/foo1/json 200 \ @@ -79,16 +78,12 @@ t DELETE libpod/volumes/foo1 404 \ .response=404 ## Prune volumes with label matching 'testlabel1=testonly' -# -G --data-urlencode 'filters={"label":["testlabel1=testonly"]}' -t POST libpod/volumes/prune?filters=%7B%22label%22:%5B%22testlabel1=testonly%22%5D%7D "" 200 -# -G --data-urlencode 'filters={"label":["testlabel1=testonly"]}' -t GET libpod/volumes/json?filters=%7B%22label%22:%5B%22testlabel1=testonly%22%5D%7D 200 length=0 +t POST libpod/volumes/prune?filters='{"label":["testlabel1=testonly"]}' "" 200 +t GET libpod/volumes/json?filters='{"label":["testlabel1=testonly"]}' 200 length=0 ## Prune volumes with label matching 'testlabel' -# -G --data-urlencode 'filters={"label":["testlabel"]}' -t POST libpod/volumes/prune?filters=%7B%22label%22:%5B%22testlabel%22%5D%7D "" 200 -# -G --data-urlencode 'filters={"label":["testlabel"]}' -t GET libpod/volumes/json?filters=%7B%22label%22:%5B%22testlabel%22%5D%7D 200 length=0 +t POST libpod/volumes/prune?filters='{"label":["testlabel"]}' "" 200 +t GET libpod/volumes/json?filters='{"label":["testlabel"]}' 200 length=0 ## Prune volumes t POST libpod/volumes/prune "" 200 diff --git a/test/apiv2/35-networks.at b/test/apiv2/35-networks.at index 25a292cc5..d3bbaf32b 100644 --- a/test/apiv2/35-networks.at +++ b/test/apiv2/35-networks.at @@ -7,57 +7,52 @@ t GET networks/non-existing-network 404 \ .cause='network not found' t POST libpod/networks/create?name=network1 '' 200 \ -.Filename~.*/network1\\.conflist + .Filename~.*/network1\\.conflist # --data '{"Subnet":{"IP":"10.10.254.0","Mask":[255,255,255,0]},"Labels":{"abc":"val"}}' t POST libpod/networks/create?name=network2 '"Subnet":{"IP":"10.10.254.0","Mask":[255,255,255,0]},"Labels":{"abc":"val"}' 200 \ -.Filename~.*/network2\\.conflist + .Filename~.*/network2\\.conflist # test for empty mask t POST libpod/networks/create '"Subnet":{"IP":"10.10.1.0","Mask":[]}' 500 \ -.cause~'.*cannot be empty' + .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' + .cause~'.*mask is invalid' # network list t GET libpod/networks/json 200 -# filters={"name":["network1"]} -t GET libpod/networks/json?filters=%7B%22name%22%3A%5B%22network1%22%5D%7D 200 \ -length=1 \ -.[0].Name=network1 +t GET libpod/networks/json?filters='{"name":["network1"]}' 200 \ + length=1 \ + .[0].Name=network1 t GET networks 200 #network list docker endpoint -#filters={"name":["network1","network2"]} -t GET networks?filters=%7B%22name%22%3A%5B%22network1%22%2C%22network2%22%5D%7D 200 \ -length=2 -#filters={"name":["network"]} -t GET networks?filters=%7B%22name%22%3A%5B%22network%22%5D%7D 200 \ -length=2 -# filters={"label":["abc"]} -t GET networks?filters=%7B%22label%22%3A%5B%22abc%22%5D%7D 200 \ -length=1 -# filters={"label":{"abc":true}} old docker filter type see #9526 -t GET networks?filters=%7B%22label%22%3A%7B%22abc%22%3Atrue%7D%7D 200 \ -length=1 -# id filter filters={"id":["a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1"]} -t GET networks?filters=%7B%22id%22%3A%5B%22a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1%22%5D%7D 200 \ -length=1 \ -.[0].Name=network1 \ -.[0].Id=a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1 -# invalid filter filters={"dangling":["1"]} -t GET networks?filters=%7B%22dangling%22%3A%5B%221%22%5D%7D 500 \ -.cause='invalid filter "dangling"' +t GET networks?filters='{"name":["network1","network2"]}' 200 \ + length=2 +t GET networks?filters='{"name":["network"]}' 200 \ + length=2 +t GET networks?filters='{"label":["abc"]}' 200 \ + length=1 +# old docker filter type see #9526 +t GET networks?filters='{"label":{"abc":true}}' 200 \ + length=1 +t GET networks?filters='{"id":["a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1"]}' 200 \ + length=1 \ + .[0].Name=network1 \ + .[0].Id=a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1 +# invalid filter +t GET networks?filters='{"dangling":["1"]}' 500 \ + .cause='invalid filter "dangling"' # (#9293 with no networks the endpoint should return empty array instead of null) -t GET networks?filters=%7B%22name%22%3A%5B%22doesnotexists%22%5D%7D 200 \ -"[]" +t GET networks?filters='{"name":["doesnotexists"]}' 200 \ + "[]" # network inspect docker t GET networks/a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1 200 \ -.Name=network1 \ -.Id=a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1 \ -.Scope=local + .Name=network1 \ + .Id=a7662f44d65029fd4635c91feea3d720a57cef52e2a9fcc7772b69072cc1ccd1 \ + .Scope=local # network create docker t POST networks/create '"Name":"net3","IPAM":{"Config":[]}' 201 @@ -66,11 +61,11 @@ t DELETE networks/net3 204 # clean the network t DELETE libpod/networks/network1 200 \ -.[0].Name~network1 \ -.[0].Err=null + .[0].Name~network1 \ + .[0].Err=null t DELETE libpod/networks/network2 200 \ -.[0].Name~network2 \ -.[0].Err=null + .[0].Name~network2 \ + .[0].Err=null # vim: filetype=sh diff --git a/test/apiv2/45-system.at b/test/apiv2/45-system.at index 985d86e56..ad4bdf4f7 100644 --- a/test/apiv2/45-system.at +++ b/test/apiv2/45-system.at @@ -49,18 +49,16 @@ t GET libpod/system/df 200 '.Volumes | length=3' # Prune volumes -# -G --data-urlencode 'volumes=true&filters={"label":["testlabel1=idontmatch"]}' -t POST 'libpod/system/prune?volumes=true&filters=%7B%22label%22:%5B%22testlabel1=idontmatch%22%5D%7D' params='' 200 +t POST 'libpod/system/prune?volumes=true&filters={"label":["testlabel1=idontmatch"]}' params='' 200 # nothing should have been pruned t GET system/df 200 '.Volumes | length=3' t GET libpod/system/df 200 '.Volumes | length=3' -# -G --data-urlencode 'volumes=true&filters={"label":["testlabel1=testonly"]}' # only foo3 should be pruned because of filter -t POST 'libpod/system/prune?volumes=true&filters=%7B%22label%22:%5B%22testlabel1=testonly%22%5D%7D' params='' 200 .VolumePruneReports[0].Id=foo3 +t POST 'libpod/system/prune?volumes=true&filters={"label":["testlabel1=testonly"]}' params='' 200 .VolumePruneReports[0].Id=foo3 # only foo2 should be pruned because of filter -t POST 'libpod/system/prune?volumes=true&filters=%7B%22label%22:%5B%22testlabel1%22%5D%7D' params='' 200 .VolumePruneReports[0].Id=foo2 +t POST 'libpod/system/prune?volumes=true&filters={"label":["testlabel1"]}' params='' 200 .VolumePruneReports[0].Id=foo2 # foo1, the last remaining volume should be pruned without any filters applied t POST 'libpod/system/prune?volumes=true' params='' 200 .VolumePruneReports[0].Id=foo1 diff --git a/test/apiv2/50-secrets.at b/test/apiv2/50-secrets.at index 1ef43381a..69e1f3ae9 100644 --- a/test/apiv2/50-secrets.at +++ b/test/apiv2/50-secrets.at @@ -25,7 +25,7 @@ t GET secrets 200\ length=1 # secret list unsupported filters -t GET secrets?filters=%7B%22name%22%3A%5B%22foo1%22%5D%7D 400 +t GET secrets?filters='{"name":["foo1"]}' 400 # secret rm t DELETE secrets/mysecret 204 diff --git a/test/apiv2/test-apiv2 b/test/apiv2/test-apiv2 index 5b1e2ef80..d545df245 100755 --- a/test/apiv2/test-apiv2 +++ b/test/apiv2/test-apiv2 @@ -188,6 +188,13 @@ function t() { # entrypoint path can include a descriptive comment; strip it off path=${path%% *} + # path may include JSONish params that curl will barf on; url-encode them + path="${path//'['/%5B}" + path="${path//']'/%5D}" + path="${path//'{'/%7B}" + path="${path//'}'/%7D}" + path="${path//':'/%3A}" + # curl -X HEAD but without --head seems to wait for output anyway if [[ $method == "HEAD" ]]; then curl_args="--head" |