diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-09-13 13:35:10 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-13 13:35:10 +0200 |
commit | d88d74639fbabfd83663ea94a11c11c7a54b781b (patch) | |
tree | 7c11ae7b8a0f8fe59e7e29ebeca6e5a43424d69f /test | |
parent | c0dd0d696e333ad42a5fa3d9428fee27b1c30061 (diff) | |
parent | 07a8eb829563df9215d86eed7b3337c14dadb6cc (diff) | |
download | podman-d88d74639fbabfd83663ea94a11c11c7a54b781b.tar.gz podman-d88d74639fbabfd83663ea94a11c11c7a54b781b.tar.bz2 podman-d88d74639fbabfd83663ea94a11c11c7a54b781b.zip |
Merge pull request #15753 from mheon/fix_15720
Ensure that the DF endpoint updated volume refcount
Diffstat (limited to 'test')
-rw-r--r-- | test/apiv2/45-system.at | 18 | ||||
-rw-r--r-- | test/system/320-system-df.bats | 2 |
2 files changed, 19 insertions, 1 deletions
diff --git a/test/apiv2/45-system.at b/test/apiv2/45-system.at index 364b87c56..096df5516 100644 --- a/test/apiv2/45-system.at +++ b/test/apiv2/45-system.at @@ -25,6 +25,24 @@ t GET system/df 200 '.Volumes[0].Name=foo1' t GET libpod/system/df 200 '.Volumes[0].VolumeName=foo1' +# Verify that no containers reference the volume +t GET system/df 200 '.Volumes[0].UsageData.RefCount=0' + +# Make a container using the volume +podman pull $IMAGE &>/dev/null +t POST containers/create Image=$IMAGE Volumes='{"/test":{}}' HostConfig='{"Binds":["foo1:/test"]}' 201 \ + .Id~[0-9a-f]\\{64\\} +cid=$(jq -r '.Id' <<<"$output") + +# Verify that one container references the volume +t GET system/df 200 '.Volumes[0].UsageData.RefCount=1' + +# Remove the container +t DELETE containers/$cid?v=true 204 + +# Verify that no containers reference the volume +t GET system/df 200 '.Volumes[0].UsageData.RefCount=0' + # Create two more volumes to test pruneing t POST libpod/volumes/create \ Name=foo2 \ diff --git a/test/system/320-system-df.bats b/test/system/320-system-df.bats index 217357b37..35e121c62 100644 --- a/test/system/320-system-df.bats +++ b/test/system/320-system-df.bats @@ -27,7 +27,7 @@ function teardown() { run_podman system df --format '{{ .Type }}:{{ .Total }}:{{ .Active }}' is "${lines[0]}" "Images:1:1" "system df : Images line" is "${lines[1]}" "Containers:2:1" "system df : Containers line" - is "${lines[2]}" "Local Volumes:2:1" "system df : Volumes line" + is "${lines[2]}" "Local Volumes:2:2" "system df : Volumes line" # Try -v. (Grrr. No way to specify individual formats) # |