Skip to content

Commit

Permalink
Merge pull request #21766 from edsantiago/fix-search-flake-again
Browse files Browse the repository at this point in the history
CI: fix search-test flakes
  • Loading branch information
openshift-merge-bot[bot] authored Feb 20, 2024
2 parents 1d4651b + 1c61f76 commit 2fbc1c1
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions test/e2e/search_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,20 @@ registries = []`
})

It("podman search format flag", func() {
search := podmanTest.Podman([]string{"search", "--format", "table {{.Index}} {{.Name}}", "alpine"})
search := podmanTest.Podman([]string{"search", "--format", "table {{.Index}} {{.Name}}", "testdigest_v2s2"})
search.WaitWithDefaultTimeout()
Expect(search).Should(ExitCleanly())
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
Expect(search.OutputToString()).To(ContainSubstring("docker.io/library/alpine"))
Expect(search.OutputToString()).To(ContainSubstring("quay.io/libpod/testdigest_v2s2"))
})

It("podman search format json", func() {
search := podmanTest.Podman([]string{"search", "--format", "json", "busybox"})
search := podmanTest.Podman([]string{"search", "--format", "json", "testdigest_v2s1"})
search.WaitWithDefaultTimeout()
Expect(search).Should(ExitCleanly())
Expect(search.OutputToString()).To(BeValidJSON())
Expect(search.OutputToString()).To(ContainSubstring("docker.io/library/busybox"))
Expect(search.OutputToString()).To(ContainSubstring("quay.io/libpod/testdigest_v2s1"))
Expect(search.OutputToString()).To(ContainSubstring("Test image used by buildah regression tests"))

// Test for https://github.com/containers/podman/issues/11894
contents := make([]entities.ImageSearchReport, 0)
Expand Down Expand Up @@ -123,17 +124,17 @@ registries = []`
})

It("podman search limit flag", func() {
search := podmanTest.Podman([]string{"search", "docker.io/alpine"})
search := podmanTest.Podman([]string{"search", "quay.io/alpine"})
search.WaitWithDefaultTimeout()
Expect(search).Should(ExitCleanly())
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 10))

search = podmanTest.Podman([]string{"search", "--limit", "3", "docker.io/alpine"})
search = podmanTest.Podman([]string{"search", "--limit", "3", "quay.io/alpine"})
search.WaitWithDefaultTimeout()
Expect(search).Should(ExitCleanly())
Expect(search.OutputToStringArray()).To(HaveLen(4))

search = podmanTest.Podman([]string{"search", "--limit", "30", "docker.io/alpine"})
search = podmanTest.Podman([]string{"search", "--limit", "30", "quay.io/alpine"})
search.WaitWithDefaultTimeout()
Expect(search).Should(ExitCleanly())
Expect(search.OutputToStringArray()).To(HaveLen(31))
Expand Down Expand Up @@ -382,23 +383,34 @@ registries = []`
})

It("podman search repository tags", func() {
search := podmanTest.Podman([]string{"search", "--list-tags", "--limit", "30", "docker.io/library/alpine"})
search := podmanTest.Podman([]string{"search", "--list-tags", "--limit", "30", "quay.io/podman/stable"})
search.WaitWithDefaultTimeout()
Expect(search).Should(ExitCleanly())
Expect(search.OutputToStringArray()).To(HaveLen(31))

search = podmanTest.Podman([]string{"search", "--list-tags", "docker.io/library/alpine"})
search = podmanTest.Podman([]string{"search", "--list-tags", "quay.io/podman/stable"})
search.WaitWithDefaultTimeout()
Expect(search).Should(ExitCleanly())
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 2))

search = podmanTest.Podman([]string{"search", "--filter=is-official", "--list-tags", "docker.io/library/alpine"})
search = podmanTest.Podman([]string{"search", "--filter=is-official", "--list-tags", "quay.io/podman/stable"})
search.WaitWithDefaultTimeout()
Expect(search).To(ExitWithError())
Expect(search).To(Exit(125))
Expect(search.ErrorToString()).To(ContainSubstring("filters are not applicable to list tags result"))

// With trailing slash
search = podmanTest.Podman([]string{"search", "--list-tags", "quay.io/podman/"})
search.WaitWithDefaultTimeout()
Expect(search).To(Exit(125))
Expect(search.OutputToStringArray()).To(BeEmpty())
Expect(search.ErrorToString()).To(ContainSubstring("must be a docker reference"))

search = podmanTest.Podman([]string{"search", "--list-tags", "docker.io/library/"})
// No trailing slash
search = podmanTest.Podman([]string{"search", "--list-tags", "quay.io/podman"})
search.WaitWithDefaultTimeout()
Expect(search).To(Exit(125))
Expect(search.OutputToStringArray()).To(BeEmpty())
Expect(search.ErrorToString()).To(ContainSubstring("fetching tags list: StatusCode: 404"))
})

It("podman search with limit over 100", func() {
Expand Down

0 comments on commit 2fbc1c1

Please sign in to comment.