From e479644177ebe2734e7659e95e551079257aa390 Mon Sep 17 00:00:00 2001 From: SamirPS Date: Fri, 23 Dec 2022 19:39:07 +0100 Subject: [PATCH] Fix: List container with volume filter Modify the condition in line 149 in order to list container by mounting point. Closes #16019 Signed-off-by: SamirPS --- pkg/domain/filters/containers.go | 2 +- test/system/160-volumes.bats | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/pkg/domain/filters/containers.go b/pkg/domain/filters/containers.go index 137f3da524..67f727fd83 100644 --- a/pkg/domain/filters/containers.go +++ b/pkg/domain/filters/containers.go @@ -146,7 +146,7 @@ func GenerateContainerFilterFuncs(filter string, filterValues []string, r *libpo if dest != "" && (mount.Source == source && mount.Destination == dest) { return true } - if dest == "" && mount.Source == source { + if dest == "" && mount.Destination == source { return true } } diff --git a/test/system/160-volumes.bats b/test/system/160-volumes.bats index 169c5f5ad7..4bdbb41cee 100644 --- a/test/system/160-volumes.bats +++ b/test/system/160-volumes.bats @@ -509,4 +509,20 @@ EOF is "$output" "" "Should print no output" } +@test "podman ps -f" { + vol1="/v1_$(random_string)" + run_podman run -d --rm --volume ${PODMAN_TMPDIR}:$vol1 $IMAGE top + cid=$output + + run_podman ps --noheading --no-trunc -q -f volume=$vol1 + is "$output" "$cid" "Should find container by volume" + + run_podman ps --noheading --no-trunc -q --filter volume=/NoSuchVolume + is "$output" "" "ps --filter volume=/NoSuchVolume" + + # Clean up + run_podman rm -f -t 0 -a +} + + # vim: filetype=sh