summaryrefslogtreecommitdiff
path: root/test/e2e/search_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e/search_test.go')
-rw-r--r--test/e2e/search_test.go38
1 files changed, 32 insertions, 6 deletions
diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go
index f82c3d9d1..10e991d9f 100644
--- a/test/e2e/search_test.go
+++ b/test/e2e/search_test.go
@@ -2,6 +2,7 @@ package integration
import (
"bytes"
+ "encoding/json"
"fmt"
"io/ioutil"
"os"
@@ -9,6 +10,7 @@ import (
"strconv"
"text/template"
+ "github.com/containers/podman/v3/pkg/domain/entities"
. "github.com/containers/podman/v3/test/utils"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
@@ -105,7 +107,18 @@ registries = ['{{.Host}}:{{.Port}}']`
search.WaitWithDefaultTimeout()
Expect(search).Should(Exit(0))
output := string(search.Out.Contents())
- match, _ := regexp.MatchString(`(?m)^quay.io\s+quay.io/libpod/whalesay\s+Static image used for automated testing.+$`, output)
+ match, _ := regexp.MatchString(`(?m)NAME\s+DESCRIPTION$`, output)
+ Expect(match).To(BeTrue())
+ match, _ = regexp.MatchString(`(?m)quay.io/libpod/whalesay\s+Static image used for automated testing.+$`, output)
+ Expect(match).To(BeTrue())
+ })
+
+ It("podman search image with --compatible", func() {
+ search := podmanTest.Podman([]string{"search", "--compatible", "quay.io/libpod/whalesay"})
+ search.WaitWithDefaultTimeout()
+ Expect(search).Should(Exit(0))
+ output := string(search.Out.Contents())
+ match, _ := regexp.MatchString(`(?m)NAME\s+DESCRIPTION\s+STARS\s+OFFICIAL\s+AUTOMATED$`, output)
Expect(match).To(BeTrue())
})
@@ -123,6 +136,15 @@ registries = ['{{.Host}}:{{.Port}}']`
Expect(search).Should(Exit(0))
Expect(search.IsJSONOutputValid()).To(BeTrue())
Expect(search.OutputToString()).To(ContainSubstring("docker.io/library/alpine"))
+
+ // Test for https://github.com/containers/podman/issues/11894
+ contents := make([]entities.ImageSearchReport, 0)
+ err := json.Unmarshal(search.Out.Contents(), &contents)
+ Expect(err).ToNot(HaveOccurred())
+ Expect(len(contents)).To(BeNumerically(">", 0), "No results from image search")
+ for _, element := range contents {
+ Expect(element.Description).ToNot(HaveSuffix("..."))
+ }
})
It("podman search format json list tags", func() {
@@ -135,13 +157,17 @@ registries = ['{{.Host}}:{{.Port}}']`
Expect(search.OutputToString()).To(ContainSubstring("2.7"))
})
- It("podman search no-trunc flag", func() {
- search := podmanTest.Podman([]string{"search", "--no-trunc", "alpine"})
+ // Test for https://github.com/containers/podman/issues/11894
+ It("podman search no-trunc=false flag", func() {
+ search := podmanTest.Podman([]string{"search", "--no-trunc=false", "alpine", "--format={{.Description}}"})
search.WaitWithDefaultTimeout()
Expect(search).Should(Exit(0))
- Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
- Expect(search.LineInOutputContains("docker.io/library/alpine")).To(BeTrue())
- Expect(search.LineInOutputContains("...")).To(BeFalse())
+
+ for _, line := range search.OutputToStringArray() {
+ if len(line) > 44 {
+ Expect(line).To(HaveSuffix("..."), line+" should have been truncated")
+ }
+ }
})
It("podman search limit flag", func() {