summaryrefslogtreecommitdiff
path: root/test/e2e/images_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/images_test.go')
-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())
+ })
})