summaryrefslogtreecommitdiff
path: root/test/e2e/volume_ls_test.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-06-24 14:10:29 -0400
committerMatthew Heon <matthew.heon@pm.me>2020-06-24 15:12:56 -0400
commitd78e83f47d487c1680ae0e2a1db42ef9d70caf30 (patch)
treec113c1f5a50a75b14ae3ed68bdf59d0ea04bc22c /test/e2e/volume_ls_test.go
parent4ee66598c1201a7d191c03c2d2f067f847aaddf5 (diff)
downloadpodman-d78e83f47d487c1680ae0e2a1db42ef9d70caf30.tar.gz
podman-d78e83f47d487c1680ae0e2a1db42ef9d70caf30.tar.bz2
podman-d78e83f47d487c1680ae0e2a1db42ef9d70caf30.zip
Add support for dangling filter to volumes
The dangling filter determine whether a volume is dangling - IE, it has no containers attached using it. Unlike our other filters, this one is a boolean - must be true or false, not arbitrary values. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'test/e2e/volume_ls_test.go')
-rw-r--r--test/e2e/volume_ls_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/e2e/volume_ls_test.go b/test/e2e/volume_ls_test.go
index 7664e64bb..d2d75af9e 100644
--- a/test/e2e/volume_ls_test.go
+++ b/test/e2e/volume_ls_test.go
@@ -1,6 +1,7 @@
package integration
import (
+ "fmt"
"os"
. "github.com/containers/libpod/test/utils"
@@ -82,4 +83,30 @@ var _ = Describe("Podman volume ls", func() {
Expect(len(session.OutputToStringArray())).To(Equal(2))
Expect(session.OutputToStringArray()[1]).To(ContainSubstring(volName))
})
+
+ It("podman volume ls with --filter dangling", func() {
+ volName1 := "volume1"
+ session := podmanTest.Podman([]string{"volume", "create", volName1})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ volName2 := "volume2"
+ session2 := podmanTest.Podman([]string{"volume", "create", volName2})
+ session2.WaitWithDefaultTimeout()
+ Expect(session2.ExitCode()).To(Equal(0))
+
+ ctr := podmanTest.Podman([]string{"create", "-v", fmt.Sprintf("%s:/test", volName2), ALPINE, "sh"})
+ ctr.WaitWithDefaultTimeout()
+ Expect(ctr.ExitCode()).To(Equal(0))
+
+ lsNoDangling := podmanTest.Podman([]string{"volume", "ls", "--filter", "dangling=false", "--quiet"})
+ lsNoDangling.WaitWithDefaultTimeout()
+ Expect(lsNoDangling.ExitCode()).To(Equal(0))
+ Expect(lsNoDangling.OutputToString()).To(ContainSubstring(volName2))
+
+ lsDangling := podmanTest.Podman([]string{"volume", "ls", "--filter", "dangling=true", "--quiet"})
+ lsDangling.WaitWithDefaultTimeout()
+ Expect(lsDangling.ExitCode()).To(Equal(0))
+ Expect(lsDangling.OutputToString()).To(ContainSubstring(volName1))
+ })
})