summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-03-26 04:51:06 -0700
committerGitHub <noreply@github.com>2019-03-26 04:51:06 -0700
commit9e556530d24a51c7d19679a2f658a367686d9874 (patch)
tree7f5881c70c53aa47685d2a663f75ed9b430a72e3 /test/e2e
parentd0c6a35c05a72e4b156819406b83aa9f34f840e0 (diff)
parent25e0f870694ff65ac4e2973072410dcfc45dd7db (diff)
downloadpodman-9e556530d24a51c7d19679a2f658a367686d9874.tar.gz
podman-9e556530d24a51c7d19679a2f658a367686d9874.tar.bz2
podman-9e556530d24a51c7d19679a2f658a367686d9874.zip
Merge pull request #2498 from QiWang19/sysdf
podman system df- show podman disk usage
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/system_df_test.go62
1 files changed, 62 insertions, 0 deletions
diff --git a/test/e2e/system_df_test.go b/test/e2e/system_df_test.go
new file mode 100644
index 000000000..92787f17c
--- /dev/null
+++ b/test/e2e/system_df_test.go
@@ -0,0 +1,62 @@
+// +build !remoteclient
+
+package integration
+
+import (
+ "fmt"
+ "os"
+ "strings"
+
+ . "github.com/containers/libpod/test/utils"
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+)
+
+var _ = Describe("podman system df", func() {
+ var (
+ tempdir string
+ err error
+ podmanTest *PodmanTestIntegration
+ )
+
+ BeforeEach(func() {
+ tempdir, err = CreateTempDirInTempDir()
+ if err != nil {
+ os.Exit(1)
+ }
+ podmanTest = PodmanTestCreate(tempdir)
+ podmanTest.RestoreAllArtifacts()
+ })
+
+ AfterEach(func() {
+ podmanTest.Cleanup()
+ f := CurrentGinkgoTestDescription()
+ timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
+ GinkgoWriter.Write([]byte(timedResult))
+ })
+
+ It("podman system df", func() {
+ session := podmanTest.Podman([]string{"create", ALPINE})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"volume", "create", "data"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"create", "-v", "data:/data", "--name", "container1", "busybox"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"system", "df"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+ Expect(len(session.OutputToStringArray())).To(Equal(4))
+ images := strings.Fields(session.OutputToStringArray()[1])
+ containers := strings.Fields(session.OutputToStringArray()[2])
+ volumes := strings.Fields(session.OutputToStringArray()[3])
+ Expect(images[1]).To(Equal("2"))
+ Expect(containers[1]).To(Equal("2"))
+ Expect(volumes[2]).To(Equal("1"))
+ })
+})