summaryrefslogtreecommitdiff
path: root/test/e2e
diff options
context:
space:
mode:
authorhaircommander <pehunt@redhat.com>2018-06-11 16:46:16 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-06-14 10:26:21 +0000
commitb868470238ee60032a50f6ed23db3c09b475842b (patch)
tree4fb678f9fbbae7b90cc7933c1ec8226b36ea7f87 /test/e2e
parent65033b586fb353734d29dac1dfb9f342d5eeaa21 (diff)
downloadpodman-b868470238ee60032a50f6ed23db3c09b475842b.tar.gz
podman-b868470238ee60032a50f6ed23db3c09b475842b.tar.bz2
podman-b868470238ee60032a50f6ed23db3c09b475842b.zip
Added --sort flag to podman image
Signed-off-by: haircommander <pehunt@redhat.com> Closes: #937 Approved by: rhatdan
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/images_test.go26
1 files changed, 24 insertions, 2 deletions
diff --git a/test/e2e/images_test.go b/test/e2e/images_test.go
index 8b9b889aa..5e30e95ec 100644
--- a/test/e2e/images_test.go
+++ b/test/e2e/images_test.go
@@ -1,9 +1,11 @@
package integration
import (
+ "fmt"
"os"
+ "sort"
- "fmt"
+ "github.com/docker/go-units"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
@@ -28,7 +30,6 @@ var _ = Describe("Podman images", func() {
podmanTest.Cleanup()
})
-
It("podman images", func() {
session := podmanTest.Podman([]string{"images"})
session.WaitWithDefaultTimeout()
@@ -143,4 +144,25 @@ var _ = Describe("Podman images", func() {
Expect(result.ExitCode()).To(Equal(0))
})
+ It("podman images sort by tag", func() {
+ session := podmanTest.Podman([]string{"images", "--sort", "tag", "--format={{.Tag}}"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ sortedArr := session.OutputToStringArray()
+ Expect(sort.SliceIsSorted(sortedArr, func(i, j int) bool { return sortedArr[i] < sortedArr[j] })).To(BeTrue())
+ })
+
+ It("podman images sort by size", func() {
+ session := podmanTest.Podman([]string{"images", "--sort", "size", "--format={{.Size}}"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ sortedArr := session.OutputToStringArray()
+ Expect(sort.SliceIsSorted(sortedArr, func(i, j int) bool {
+ size1, _ := units.FromHumanSize(sortedArr[i])
+ size2, _ := units.FromHumanSize(sortedArr[j])
+ return size1 < size2
+ })).To(BeTrue())
+ })
})