summaryrefslogtreecommitdiff
path: root/pkg/bindings/test/system_test.go
diff options
context:
space:
mode:
authorSujil02 <sushah@redhat.com>2020-05-05 22:29:54 -0400
committerSujil02 <sushah@redhat.com>2020-05-11 17:03:32 -0400
commit1c6ae73a898222a14b98526339d9985c51f88d35 (patch)
tree0abf9eebf0625817cf92b77e03348543402d96b3 /pkg/bindings/test/system_test.go
parentdc7d6f4818f4b986cfd15208d53f6765d8fad986 (diff)
downloadpodman-1c6ae73a898222a14b98526339d9985c51f88d35.tar.gz
podman-1c6ae73a898222a14b98526339d9985c51f88d35.tar.bz2
podman-1c6ae73a898222a14b98526339d9985c51f88d35.zip
Adds tunnel routes for system reset.
Adds tunnel routes for system reset. Makes forces flag local as options are not propogated down the stack. Adds relevant test cases and swagger docs. Signed-off-by: Sujil02 <sushah@redhat.com>
Diffstat (limited to 'pkg/bindings/test/system_test.go')
-rw-r--r--pkg/bindings/test/system_test.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/pkg/bindings/test/system_test.go b/pkg/bindings/test/system_test.go
index 62ea32377..76f0b074b 100644
--- a/pkg/bindings/test/system_test.go
+++ b/pkg/bindings/test/system_test.go
@@ -5,6 +5,7 @@ import (
"github.com/containers/libpod/pkg/bindings"
"github.com/containers/libpod/pkg/bindings/containers"
+ "github.com/containers/libpod/pkg/bindings/images"
"github.com/containers/libpod/pkg/bindings/pods"
"github.com/containers/libpod/pkg/bindings/system"
"github.com/containers/libpod/pkg/bindings/volumes"
@@ -149,4 +150,45 @@ var _ = Describe("Podman system", func() {
// Volume should be pruned now as flag set true
Expect(len(systemPruneResponse.VolumePruneReport)).To(Equal(1))
})
+
+ It("podman system reset", func() {
+ // Adding an unused volume should work
+ _, err := volumes.Create(bt.conn, entities.VolumeCreateOptions{})
+ Expect(err).To(BeNil())
+
+ vols, err := volumes.List(bt.conn, nil)
+ Expect(err).To(BeNil())
+ Expect(len(vols)).To(Equal(1))
+
+ // Start a pod and leave it running
+ _, err = pods.Start(bt.conn, newpod)
+ Expect(err).To(BeNil())
+
+ imageSummary, err := images.List(bt.conn, nil, nil)
+ Expect(err).To(BeNil())
+ // Since in the begin context images are created
+ Expect(len(imageSummary)).To(Equal(3))
+
+ err = system.Reset(bt.conn)
+ Expect(err).To(BeNil())
+
+ // re-establish connection
+ s = bt.startAPIService()
+ time.Sleep(1 * time.Second)
+
+ // No pods
+ podSummary, err := pods.List(bt.conn, nil)
+ Expect(err).To(BeNil())
+ Expect(len(podSummary)).To(Equal(0))
+
+ // No images
+ imageSummary, err = images.List(bt.conn, &bindings.PTrue, nil)
+ Expect(err).To(BeNil())
+ Expect(len(imageSummary)).To(Equal(0))
+
+ // no volumes
+ vols, err = volumes.List(bt.conn, nil)
+ Expect(err).To(BeNil())
+ Expect(len(vols)).To(BeZero())
+ })
})