diff options
author | Jakub Guzik <jakubmguzik@gmail.com> | 2021-03-20 22:56:01 +0100 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-03-29 13:48:59 -0400 |
commit | 96ffce2198785c9d5717e3104f0afd8a0c38b6af (patch) | |
tree | 7f141964ca81f132eb6f470204c1ad552607ede3 /test | |
parent | e772719bfd5f06442ed682d32e85cbe9e47ec558 (diff) | |
download | podman-96ffce2198785c9d5717e3104f0afd8a0c38b6af.tar.gz podman-96ffce2198785c9d5717e3104f0afd8a0c38b6af.tar.bz2 podman-96ffce2198785c9d5717e3104f0afd8a0c38b6af.zip |
Fix containers list/prune http api filter behaviour
The problem described in #9711 and followed by #9758 affects
containers as well. When user provides wrong filter input, error
message should occur, not fallback to full list/prune command.
This change fixes the issue. Additionally, there are error message
fixes for docker http api compat.
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/apiv2/20-containers.at | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/apiv2/20-containers.at b/test/apiv2/20-containers.at index 478717700..9030f0095 100644 --- a/test/apiv2/20-containers.at +++ b/test/apiv2/20-containers.at @@ -280,6 +280,32 @@ t GET containers/json 200 \ podman stop bar +#compat api list containers sanity checks +t GET containers/json?filters='garb1age}' 500 \ + .cause="invalid character 'g' looking for beginning of value" +t GET containers/json?filters='{"label":["testl' 500 \ + .cause="unexpected end of JSON input" + +#libpod api list containers sanity checks +t GET libpod/containers/json?filters='garb1age}' 500 \ + .cause="invalid character 'g' looking for beginning of value" +t GET libpod/containers/json?filters='{"label":["testl' 500 \ + .cause="unexpected end of JSON input" + +# Prune containers - bad filter input +t POST containers/prune?filters='garb1age}' 500 \ + .cause="invalid character 'g' looking for beginning of value" +t POST libpod/containers/prune?filters='garb1age}' 500 \ + .cause="invalid character 'g' looking for beginning of value" + +## Prune containers with illformed label +t POST containers/prune?filters='{"label":["tes' 500 \ + .cause="unexpected end of JSON input" +t POST libpod/containers/prune?filters='{"label":["tes' 500 \ + .cause="unexpected end of JSON input" + +t GET libpod/containers/json?filters='{"label":["testlabel"]}' 200 length=0 + # Test CPU limit (NanoCPUs) t POST containers/create Image=$IMAGE HostConfig='{"NanoCpus":500000}' 201 \ .Id~[0-9a-f]\\{64\\} |