summaryrefslogtreecommitdiff
path: root/pkg/bindings/test/containers_test.go
diff options
context:
space:
mode:
authorJakub Guzik <jakubmguzik@gmail.com>2021-04-01 12:10:31 +0200
committerJakub Guzik <jakubmguzik@gmail.com>2021-04-01 12:10:31 +0200
commitc5beaf0e17185f6425df1f9db8fccbca370200cb (patch)
tree42101c7335a1de653aea113c2486169fd6791ca8 /pkg/bindings/test/containers_test.go
parent12881abc065afda5bf979accfead542d411f48d6 (diff)
downloadpodman-c5beaf0e17185f6425df1f9db8fccbca370200cb.tar.gz
podman-c5beaf0e17185f6425df1f9db8fccbca370200cb.tar.bz2
podman-c5beaf0e17185f6425df1f9db8fccbca370200cb.zip
Recreate until container prune tests for bindings
Signed-off-by: Jakub Guzik <jakubmguzik@gmail.com>
Diffstat (limited to 'pkg/bindings/test/containers_test.go')
-rw-r--r--pkg/bindings/test/containers_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/pkg/bindings/test/containers_test.go b/pkg/bindings/test/containers_test.go
index 4f049d18b..4d1361746 100644
--- a/pkg/bindings/test/containers_test.go
+++ b/pkg/bindings/test/containers_test.go
@@ -568,6 +568,35 @@ var _ = Describe("Podman containers ", func() {
Expect(err).To(BeNil())
Expect(len(reports.PruneReportsIds(pruneResponse))).To(Equal(0))
Expect(len(reports.PruneReportsErrs(pruneResponse))).To(Equal(0))
+
+ // Valid filter params container should be pruned now.
+ filters := map[string][]string{
+ "until": {"5000000000"}, //Friday, June 11, 2128
+ }
+ pruneResponse, err = containers.Prune(bt.conn, new(containers.PruneOptions).WithFilters(filters))
+ Expect(err).To(BeNil())
+ Expect(len(reports.PruneReportsErrs(pruneResponse))).To(Equal(0))
+ Expect(len(reports.PruneReportsIds(pruneResponse))).To(Equal(1))
+ })
+
+ It("podman list containers with until filter", func() {
+ var name = "top"
+ _, err := bt.RunTopContainer(&name, nil)
+ Expect(err).To(BeNil())
+
+ filters := map[string][]string{
+ "until": {"5000000000"}, //Friday, June 11, 2128
+ }
+ c, err := containers.List(bt.conn, new(containers.ListOptions).WithFilters(filters).WithAll(true))
+ Expect(err).To(BeNil())
+ Expect(len(c)).To(Equal(1))
+
+ filters = map[string][]string{
+ "until": {"500000"}, // Tuesday, January 6, 1970
+ }
+ c, err = containers.List(bt.conn, new(containers.ListOptions).WithFilters(filters).WithAll(true))
+ Expect(err).To(BeNil())
+ Expect(len(c)).To(Equal(0))
})
It("podman prune running containers", func() {