summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-06-23 15:52:30 -0400
committerGitHub <noreply@github.com>2021-06-23 15:52:30 -0400
commitd95ff1a687c12e794e808a8a535e2ab5a2becd03 (patch)
treed1dd83249af95606c99363fa89a6a5afbe66c97f /test
parent3f3feaa015af6e0831daf039f1cd5a0cba3de6c2 (diff)
parenta0b24de32fa3459ab01d3f667384c51b0d7e43d0 (diff)
downloadpodman-d95ff1a687c12e794e808a8a535e2ab5a2becd03.tar.gz
podman-d95ff1a687c12e794e808a8a535e2ab5a2becd03.tar.bz2
podman-d95ff1a687c12e794e808a8a535e2ab5a2becd03.zip
Merge pull request #10756 from jmguzik/volume-prune-until-http-api
Add support for volume prune until filter to http api
Diffstat (limited to 'test')
-rw-r--r--test/apiv2/30-volumes.at47
1 files changed, 42 insertions, 5 deletions
diff --git a/test/apiv2/30-volumes.at b/test/apiv2/30-volumes.at
index ed606134a..5feceea7b 100644
--- a/test/apiv2/30-volumes.at
+++ b/test/apiv2/30-volumes.at
@@ -125,11 +125,6 @@ t POST libpod/volumes/prune?filters='{"label":["tes' 500 \
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
-#After prune volumes, there should be no volume existing
-t GET libpod/volumes/json 200 length=0
-
# libpod api: do not use list filters for prune
t POST libpod/volumes/prune?filters='{"name":["anyname"]}' 500 \
.cause="\"name\" is an invalid volume filter"
@@ -146,4 +141,46 @@ t POST volumes/prune?filters='{"driver":["anydriver"]}' 500 \
t POST volumes/prune?filters='{"scope":["anyscope"]}' 500 \
.cause="\"scope\" is an invalid volume filter"
+## Prune volumes using until filter
+t POST libpod/volumes/create \
+ Name=foo5 \
+ Label='{"testuntil":""}' \
+ Options='{"type":"tmpfs","o":"nodev,noexec"}}' \
+ 201 \
+ .Name=foo5 \
+ .Labels.testuntil="" \
+ .Options.type=tmpfs \
+ .Options.o=nodev,noexec
+
+# with date way back in the past, volume should not be deleted
+t POST libpod/volumes/prune?filters='{"until":["500000"]}' 200
+t GET libpod/volumes/json?filters='{"label":["testuntil"]}' 200 length=1
+
+# with date far in the future, volume should be deleted
+t POST libpod/volumes/prune?filters='{"until":["5000000000"]}' 200
+t GET libpod/volumes/json?filters='{"label":["testuntil"]}' 200 length=0
+
+t POST libpod/volumes/create \
+ Name=foo6 \
+ Label='{"testuntilcompat":""}' \
+ Options='{"type":"tmpfs","o":"nodev,noexec"}}' \
+ 201 \
+ .Name=foo6 \
+ .Labels.testuntilcompat="" \
+ .Options.type=tmpfs \
+ .Options.o=nodev,noexec
+
+# with date way back in the past, volume should not be deleted (compat api)
+t POST volumes/prune?filters='{"until":["500000"]}' 200
+t GET libpod/volumes/json?filters='{"label":["testuntilcompat"]}' 200 length=1
+
+# with date far in the future, volume should be deleted (compat api)
+t POST volumes/prune?filters='{"until":["5000000000"]}' 200
+t GET libpod/volumes/json?filters='{"label":["testuntilcompat"]}' 200 length=0
+
+## Prune volumes
+t POST libpod/volumes/prune 200
+#After prune volumes, there should be no volume existing
+t GET libpod/volumes/json 200 length=0
+
# vim: filetype=sh