test: organize search tests with BeforeEach/AfterEach patterns

Signed-off-by: Jan Rodák <hony.com@seznam.cz>
This commit is contained in:
Jan Rodák
2025-10-22 11:51:55 +02:00
parent 6b9310a0db
commit af2d913f3d

View File

@@ -6,6 +6,7 @@ import (
"bytes" "bytes"
"encoding/json" "encoding/json"
"fmt" "fmt"
"net/http"
"os" "os"
"strconv" "strconv"
"text/template" "text/template"
@@ -69,251 +70,248 @@ registries = []`
return image return image
} }
It("podman search", func() { Context("podman search with mock registry", func() {
registryAddress, srv, serverErr := CreateMockRegistryServer() var registryAddress string
defer CloseMockRegistryServer(srv, serverErr) var srv *http.Server
var serverErr chan error
search := podmanTest.PodmanExitCleanly("search", "--tls-verify=false", registryAddress+"/alpine") BeforeEach(func() {
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1)) registryAddress, srv, serverErr = CreateMockRegistryServer()
Expect(search.OutputToString()).To(ContainSubstring("alpine")) })
})
It("podman search single registry flag", func() { AfterEach(func() {
registryAddress, srv, serverErr := CreateMockRegistryServer() CloseMockRegistryServer(srv, serverErr)
defer CloseMockRegistryServer(srv, serverErr) })
search := podmanTest.PodmanExitCleanly("search", "--tls-verify=false", registryAddress+"/skopeo/stable:latest") It("podman search", func() {
Expect(search.OutputToString()).To(ContainSubstring(registryAddress + "/skopeo/stable")) search := podmanTest.PodmanExitCleanly("search", "--tls-verify=false", registryAddress+"/alpine")
}) Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
Expect(search.OutputToString()).To(ContainSubstring("alpine"))
})
It("podman search image with description", func() { It("podman search single registry flag", func() {
registryAddress, srv, serverErr := CreateMockRegistryServer() search := podmanTest.PodmanExitCleanly("search", "--tls-verify=false", registryAddress+"/skopeo/stable:latest")
defer CloseMockRegistryServer(srv, serverErr) Expect(search.OutputToString()).To(ContainSubstring(registryAddress + "/skopeo/stable"))
})
search := podmanTest.PodmanExitCleanly("search", "--tls-verify=false", registryAddress+"/podman/stable") It("podman search image with description", func() {
output := string(search.Out.Contents()) search := podmanTest.PodmanExitCleanly("search", "--tls-verify=false", registryAddress+"/podman/stable")
Expect(output).To(MatchRegexp(`(?m)NAME\s+DESCRIPTION$`)) output := string(search.Out.Contents())
Expect(output).To(MatchRegexp(`(?m)/podman/stable\s+.*Podman Image`)) Expect(output).To(MatchRegexp(`(?m)NAME\s+DESCRIPTION$`))
}) Expect(output).To(MatchRegexp(`(?m)/podman/stable\s+.*Podman Image`))
})
It("podman search image with --compatible", func() { It("podman search image with --compatible", func() {
registryAddress, srv, serverErr := CreateMockRegistryServer() search := podmanTest.PodmanExitCleanly("search", "--compatible", "--tls-verify=false", registryAddress+"/podman/stable")
defer CloseMockRegistryServer(srv, serverErr) output := string(search.Out.Contents())
Expect(output).To(MatchRegexp(`(?m)NAME\s+DESCRIPTION\s+STARS\s+OFFICIAL\s+AUTOMATED$`))
})
search := podmanTest.PodmanExitCleanly("search", "--compatible", "--tls-verify=false", registryAddress+"/podman/stable") It("podman search format flag", func() {
output := string(search.Out.Contents()) search := podmanTest.PodmanExitCleanly("search", "--format", "table {{.Index}} {{.Name}}", "--tls-verify=false", registryAddress+"/testdigest_v2s2")
Expect(output).To(MatchRegexp(`(?m)NAME\s+DESCRIPTION\s+STARS\s+OFFICIAL\s+AUTOMATED$`)) Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
}) Expect(search.OutputToString()).To(ContainSubstring(registryAddress + "/libpod/testdigest_v2s2"))
})
It("podman search format flag", func() { It("podman search format json", func() {
registryAddress, srv, serverErr := CreateMockRegistryServer() search := podmanTest.PodmanExitCleanly("search", "--format", "json", "--tls-verify=false", registryAddress+"/testdigest_v2s1")
defer CloseMockRegistryServer(srv, serverErr) Expect(search.OutputToString()).To(BeValidJSON())
Expect(search.OutputToString()).To(ContainSubstring(registryAddress + "/libpod/testdigest_v2s1"))
Expect(search.OutputToString()).To(ContainSubstring("Test image used by buildah regression tests"))
search := podmanTest.PodmanExitCleanly("search", "--format", "table {{.Index}} {{.Name}}", "--tls-verify=false", registryAddress+"/testdigest_v2s2") // Test for https://github.com/containers/podman/issues/11894
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1)) contents := make([]entities.ImageSearchReport, 0)
Expect(search.OutputToString()).To(ContainSubstring(registryAddress + "/libpod/testdigest_v2s2")) err := json.Unmarshal(search.Out.Contents(), &contents)
}) Expect(err).ToNot(HaveOccurred())
Expect(contents).ToNot(BeEmpty(), "No results from image search")
for _, element := range contents {
Expect(element.Description).ToNot(HaveSuffix("..."))
}
})
It("podman search format json", func() { It("podman search format json list tags", func() {
registryAddress, srv, serverErr := CreateMockRegistryServer() search := podmanTest.PodmanExitCleanly("search", "--list-tags", "--format", "json", "--tls-verify=false", registryAddress+"/libpod/alpine:latest")
defer CloseMockRegistryServer(srv, serverErr) Expect(search.OutputToString()).To(BeValidJSON())
Expect(search.OutputToString()).To(ContainSubstring(registryAddress + "/libpod/alpine"))
search := podmanTest.PodmanExitCleanly("search", "--format", "json", "--tls-verify=false", registryAddress+"/testdigest_v2s1") Expect(search.OutputToString()).To(ContainSubstring("3.10.2"))
Expect(search.OutputToString()).To(BeValidJSON()) Expect(search.OutputToString()).To(ContainSubstring("3.2"))
Expect(search.OutputToString()).To(ContainSubstring(registryAddress + "/libpod/testdigest_v2s1")) })
Expect(search.OutputToString()).To(ContainSubstring("Test image used by buildah regression tests"))
// Test for https://github.com/containers/podman/issues/11894 // Test for https://github.com/containers/podman/issues/11894
contents := make([]entities.ImageSearchReport, 0) It("podman search no-trunc=false flag", func() {
err := json.Unmarshal(search.Out.Contents(), &contents) search := podmanTest.PodmanExitCleanly("search", "--no-trunc=false", "--tls-verify=false", registryAddress+"/alpine", "--format={{.Description}}")
Expect(err).ToNot(HaveOccurred())
Expect(contents).ToNot(BeEmpty(), "No results from image search")
for _, element := range contents {
Expect(element.Description).ToNot(HaveSuffix("..."))
}
})
It("podman search format json list tags", func() { for _, line := range search.OutputToStringArray() {
registryAddress, srv, serverErr := CreateMockRegistryServer() if len(line) > 44 {
defer CloseMockRegistryServer(srv, serverErr) Expect(line).To(HaveSuffix("..."), line+" should have been truncated")
}
search := podmanTest.PodmanExitCleanly("search", "--list-tags", "--format", "json", "--tls-verify=false", registryAddress+"/libpod/alpine:latest")
Expect(search.OutputToString()).To(BeValidJSON())
Expect(search.OutputToString()).To(ContainSubstring(registryAddress + "/libpod/alpine"))
Expect(search.OutputToString()).To(ContainSubstring("3.10.2"))
Expect(search.OutputToString()).To(ContainSubstring("3.2"))
})
// Test for https://github.com/containers/podman/issues/11894
It("podman search no-trunc=false flag", func() {
registryAddress, srv, serverErr := CreateMockRegistryServer()
defer CloseMockRegistryServer(srv, serverErr)
search := podmanTest.PodmanExitCleanly("search", "--no-trunc=false", "--tls-verify=false", registryAddress+"/alpine", "--format={{.Description}}")
for _, line := range search.OutputToStringArray() {
if len(line) > 44 {
Expect(line).To(HaveSuffix("..."), line+" should have been truncated")
} }
} })
It("podman search limit flag", func() {
search := podmanTest.PodmanExitCleanly("search", "--tls-verify=false", registryAddress+"/alpine")
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 10))
search = podmanTest.PodmanExitCleanly("search", "--limit", "3", "--tls-verify=false", registryAddress+"/alpine")
search.WaitWithDefaultTimeout()
Expect(search).Should(ExitCleanly())
Expect(search.OutputToStringArray()).To(HaveLen(4))
search = podmanTest.PodmanExitCleanly("search", "--limit", "10", "--tls-verify=false", registryAddress+"/alpine")
Expect(search.OutputToStringArray()).To(HaveLen(11))
})
It("podman search with filter stars", func() {
search := podmanTest.PodmanExitCleanly("search", "--filter", "stars=10", "--format", "{{.Stars}}", "--tls-verify=false", registryAddress+"/alpine")
output := search.OutputToStringArray()
for i := range output {
Expect(strconv.Atoi(output[i])).To(BeNumerically(">=", 10))
}
})
It("podman search with filter is-official", func() {
search := podmanTest.PodmanExitCleanly("search", "--filter", "is-official", "--format", "{{.Official}}", "--tls-verify=false", registryAddress+"/alpine")
output := search.OutputToStringArray()
for i := range output {
Expect(output[i]).To(Equal("[OK]"))
}
})
It("podman search with filter is-automated", func() {
search := podmanTest.PodmanExitCleanly("search", "--filter", "is-automated=false", "--format", "{{.Automated}}", "--tls-verify=false", registryAddress+"/alpine")
output := search.OutputToStringArray()
for i := range output {
Expect(output[i]).To(Equal(""))
}
})
It("podman search format list tags with custom", func() {
search := podmanTest.PodmanExitCleanly("search", "--list-tags", "--format", "{{.Name}}", "--limit", "1", "--tls-verify=false", registryAddress+"/libpod/alpine")
Expect(search.OutputToString()).To(Equal(registryAddress + "/libpod/alpine"))
})
It("podman search with wildcards", func() {
search := podmanTest.PodmanExitCleanly("search", "--tls-verify=false", registryAddress+"/*alpine*")
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
Expect(search.OutputToString()).To(ContainSubstring("alpine"))
})
It("podman search repository tags", func() {
search := podmanTest.PodmanExitCleanly("search", "--list-tags", "--limit", "30", "--tls-verify=false", registryAddress+"/podman/stable")
Expect(search.OutputToStringArray()).To(HaveLen(31))
search = podmanTest.PodmanExitCleanly("search", "--list-tags", "--tls-verify=false", registryAddress+"/podman/stable")
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 2))
search = podmanTest.Podman([]string{"search", "--filter=is-official", "--list-tags", "--tls-verify=false", registryAddress + "/podman/stable"})
search.WaitWithDefaultTimeout()
Expect(search).To(ExitWithError(125, "filters are not applicable to list tags result"))
// With trailing slash
search = podmanTest.Podman([]string{"search", "--list-tags", "--tls-verify=false", registryAddress + "/podman/"})
search.WaitWithDefaultTimeout()
Expect(search).To(ExitWithError(125, `reference "podman/" must be a docker reference`))
Expect(search.OutputToStringArray()).To(BeEmpty())
// No trailing slash
search = podmanTest.Podman([]string{"search", "--list-tags", "--tls-verify=false", registryAddress + "/podman"})
search.WaitWithDefaultTimeout()
Expect(search).To(ExitWithError(125, "getting repository tags: fetching tags list: StatusCode: 404"))
Expect(search.OutputToStringArray()).To(BeEmpty())
})
It("podman search with limit over 100", func() {
search := podmanTest.PodmanExitCleanly("search", "--limit", "100", "--tls-verify=false", registryAddress+"/podman")
Expect(len(search.OutputToStringArray())).To(BeNumerically("<=", 101))
})
}) })
It("podman search limit flag", func() { Context("podman search with container-based registries", func() {
registryAddress, srv, serverErr := CreateMockRegistryServer() var ep endpoint
defer CloseMockRegistryServer(srv, serverErr) var image string
var registryName string
var port int64
search := podmanTest.PodmanExitCleanly("search", "--tls-verify=false", registryAddress+"/alpine") setupRegistryConfig := func(ep endpoint, registryName string, template *template.Template) {
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 10)) var buffer bytes.Buffer
err := template.Execute(&buffer, ep)
search = podmanTest.PodmanExitCleanly("search", "--limit", "3", "--tls-verify=false", registryAddress+"/alpine") Expect(err).ToNot(HaveOccurred())
search.WaitWithDefaultTimeout() podmanTest.setRegistriesConfigEnv(buffer.Bytes())
Expect(search).Should(ExitCleanly()) err = os.WriteFile(fmt.Sprintf("%s/%s.conf", tempdir, registryName), buffer.Bytes(), 0o644)
Expect(search.OutputToStringArray()).To(HaveLen(4)) Expect(err).ToNot(HaveOccurred())
search = podmanTest.PodmanExitCleanly("search", "--limit", "10", "--tls-verify=false", registryAddress+"/alpine")
Expect(search.OutputToStringArray()).To(HaveLen(11))
})
It("podman search with filter stars", func() {
registryAddress, srv, serverErr := CreateMockRegistryServer()
defer CloseMockRegistryServer(srv, serverErr)
search := podmanTest.PodmanExitCleanly("search", "--filter", "stars=10", "--format", "{{.Stars}}", "--tls-verify=false", registryAddress+"/alpine")
output := search.OutputToStringArray()
for i := range output {
Expect(strconv.Atoi(output[i])).To(BeNumerically(">=", 10))
}
})
It("podman search with filter is-official", func() {
registryAddress, srv, serverErr := CreateMockRegistryServer()
defer CloseMockRegistryServer(srv, serverErr)
search := podmanTest.PodmanExitCleanly("search", "--filter", "is-official", "--format", "{{.Official}}", "--tls-verify=false", registryAddress+"/alpine")
output := search.OutputToStringArray()
for i := range output {
Expect(output[i]).To(Equal("[OK]"))
}
})
It("podman search with filter is-automated", func() {
registryAddress, srv, serverErr := CreateMockRegistryServer()
defer CloseMockRegistryServer(srv, serverErr)
search := podmanTest.PodmanExitCleanly("search", "--filter", "is-automated=false", "--format", "{{.Automated}}", "--tls-verify=false", registryAddress+"/alpine")
output := search.OutputToStringArray()
for i := range output {
Expect(output[i]).To(Equal(""))
}
})
It("podman search format list tags with custom", func() {
registryAddress, srv, serverErr := CreateMockRegistryServer()
defer CloseMockRegistryServer(srv, serverErr)
search := podmanTest.PodmanExitCleanly("search", "--list-tags", "--format", "{{.Name}}", "--limit", "1", "--tls-verify=false", registryAddress+"/libpod/alpine")
Expect(search.OutputToString()).To(Equal(registryAddress + "/libpod/alpine"))
})
It("podman search attempts HTTP if tls-verify flag is set false", func() {
ep := mockFakeRegistryServerAsContainer("registry")
// if this test succeeded, there will be no output (there is no entry named fake/image:andtag in an empty registry)
// and the exit code will be 0
search := podmanTest.PodmanExitCleanly("search", fmt.Sprintf("%s/fake/image:andtag", ep.Address()), "--tls-verify=false")
Expect(search.OutputToString()).Should(BeEmpty())
})
It("podman search in local registry", func() {
ep := mockFakeRegistryServerAsContainer("registry3")
image := pushAlpineImageIntoMockRegistry(ep)
search := podmanTest.PodmanExitCleanly("search", image, "--tls-verify=false")
Expect(search.OutputToString()).ShouldNot(BeEmpty())
// podman search v2 registry with empty query
searchEmpty := podmanTest.PodmanExitCleanly("search", fmt.Sprintf("%s/", ep.Address()), "--tls-verify=false")
Expect(searchEmpty.OutputToStringArray()).ToNot(BeEmpty())
Expect(search.OutputToString()).To(ContainSubstring("my-alpine"))
})
It("podman search attempts HTTP if registry is in registries.insecure and force secure is false", func() {
ep := mockFakeRegistryServerAsContainer("registry4")
image := pushAlpineImageIntoMockRegistry(ep)
// registries.conf set up
var buffer bytes.Buffer
err = registryFileTmpl.Execute(&buffer, ep)
Expect(err).ToNot(HaveOccurred())
podmanTest.setRegistriesConfigEnv(buffer.Bytes())
err = os.WriteFile(fmt.Sprintf("%s/registry4.conf", tempdir), buffer.Bytes(), 0o644)
Expect(err).ToNot(HaveOccurred())
if IsRemote() {
podmanTest.RestartRemoteService()
defer podmanTest.RestartRemoteService()
} }
search := podmanTest.PodmanExitCleanly("search", image) BeforeEach(func() {
Expect(search.OutputToString()).To(ContainSubstring("my-alpine")) registryName = fmt.Sprintf("registry%d", GinkgoRandomSeed())
ep = mockFakeRegistryServerAsContainer(registryName)
image = pushAlpineImageIntoMockRegistry(ep)
// cleanup port, err = strconv.ParseInt(ep.Port, 10, 64)
resetRegistriesConfigEnv() Expect(err).ToNot(HaveOccurred())
}) })
It("podman search doesn't attempt HTTP if force secure is true", func() { AfterEach(func() {
ep := mockFakeRegistryServerAsContainer("registry5") resetRegistriesConfigEnv()
podmanTest.PodmanExitCleanly("rm", "-f", registryName)
})
port, err := strconv.ParseInt(ep.Port, 10, 64) It("podman search attempts HTTP if tls-verify flag is set false", func() {
Expect(err).ToNot(HaveOccurred()) // if this test succeeded, there will be no output (there is no entry named fake/image:andtag in an empty registry)
// and the exit code will be 0
search := podmanTest.PodmanExitCleanly("search", fmt.Sprintf("%s/fake/image:andtag", ep.Address()), "--tls-verify=false")
Expect(search.OutputToString()).Should(BeEmpty())
})
image := pushAlpineImageIntoMockRegistry(ep) It("podman search in local registry", func() {
search := podmanTest.PodmanExitCleanly("search", image, "--tls-verify=false")
Expect(search.OutputToString()).ShouldNot(BeEmpty())
var buffer bytes.Buffer // podman search v2 registry with empty query
err = registryFileTmpl.Execute(&buffer, ep) searchEmpty := podmanTest.PodmanExitCleanly("search", fmt.Sprintf("%s/", ep.Address()), "--tls-verify=false")
Expect(err).ToNot(HaveOccurred()) Expect(searchEmpty.OutputToStringArray()).ToNot(BeEmpty())
podmanTest.setRegistriesConfigEnv(buffer.Bytes()) Expect(search.OutputToString()).To(ContainSubstring("my-alpine"))
err = os.WriteFile(fmt.Sprintf("%s/registry5.conf", tempdir), buffer.Bytes(), 0o644) })
Expect(err).ToNot(HaveOccurred())
search := podmanTest.Podman([]string{"search", image, "--tls-verify=true"}) It("podman search attempts HTTP if registry is in registries.insecure and force secure is false", func() {
search.WaitWithDefaultTimeout() // registries.conf set up
setupRegistryConfig(ep, registryName, registryFileTmpl)
if IsRemote() {
podmanTest.RestartRemoteService()
defer podmanTest.RestartRemoteService()
}
Expect(search).Should(ExitWithError(125, fmt.Sprintf(`couldn't search registry "localhost:%d": pinging container registry localhost:%d: Get "https://localhost:%d/v2/": http: server gave HTTP response to HTTPS client`, port, port, port))) search := podmanTest.PodmanExitCleanly("search", image)
Expect(search.OutputToString()).Should(BeEmpty()) Expect(search.OutputToString()).To(ContainSubstring("my-alpine"))
})
// cleanup It("podman search doesn't attempt HTTP if force secure is true", func() {
resetRegistriesConfigEnv() setupRegistryConfig(ep, registryName, registryFileTmpl)
}) if IsRemote() {
podmanTest.RestartRemoteService()
defer podmanTest.RestartRemoteService()
}
It("podman search doesn't attempt HTTP if registry is not listed as insecure", func() { search := podmanTest.Podman([]string{"search", image, "--tls-verify=true"})
ep := mockFakeRegistryServerAsContainer("registry6") search.WaitWithDefaultTimeout()
port, err := strconv.ParseInt(ep.Port, 10, 64) Expect(search).Should(ExitWithError(125, fmt.Sprintf(`couldn't search registry "localhost:%d": pinging container registry localhost:%d: Get "https://localhost:%d/v2/": http: server gave HTTP response to HTTPS client`, port, port, port)))
Expect(err).ToNot(HaveOccurred()) Expect(search.OutputToString()).Should(BeEmpty())
})
image := pushAlpineImageIntoMockRegistry(ep) It("podman search doesn't attempt HTTP if registry is not listed as insecure", func() {
setupRegistryConfig(ep, registryName, registryFileBadTmpl)
if IsRemote() {
podmanTest.RestartRemoteService()
defer podmanTest.RestartRemoteService()
}
var buffer bytes.Buffer search := podmanTest.Podman([]string{"search", image})
err = registryFileBadTmpl.Execute(&buffer, ep) search.WaitWithDefaultTimeout()
Expect(err).ToNot(HaveOccurred())
podmanTest.setRegistriesConfigEnv(buffer.Bytes())
err = os.WriteFile(fmt.Sprintf("%s/registry6.conf", tempdir), buffer.Bytes(), 0o644)
Expect(err).ToNot(HaveOccurred())
if IsRemote() { Expect(search).Should(ExitWithError(125, fmt.Sprintf(`couldn't search registry "localhost:%d": pinging container registry localhost:%d: Get "https://localhost:%d/v2/": http: server gave HTTP response to HTTPS client`, port, port, port)))
podmanTest.RestartRemoteService() Expect(search.OutputToString()).Should(BeEmpty())
defer podmanTest.RestartRemoteService() })
}
search := podmanTest.Podman([]string{"search", image})
search.WaitWithDefaultTimeout()
Expect(search).Should(ExitWithError(125, fmt.Sprintf(`couldn't search registry "localhost:%d": pinging container registry localhost:%d: Get "https://localhost:%d/v2/": http: server gave HTTP response to HTTPS client`, port, port, port)))
Expect(search.OutputToString()).Should(BeEmpty())
// cleanup
resetRegistriesConfigEnv()
}) })
// search should fail with nonexistent authfile // search should fail with nonexistent authfile
@@ -322,48 +320,4 @@ registries = []`
search.WaitWithDefaultTimeout() search.WaitWithDefaultTimeout()
Expect(search).To(ExitWithError(125, "credential file is not accessible: faccessat /tmp/nonexistent: no such file or directory")) Expect(search).To(ExitWithError(125, "credential file is not accessible: faccessat /tmp/nonexistent: no such file or directory"))
}) })
It("podman search with wildcards", func() {
registryAddress, srv, serverErr := CreateMockRegistryServer()
defer CloseMockRegistryServer(srv, serverErr)
search := podmanTest.PodmanExitCleanly("search", "--tls-verify=false", registryAddress+"/*alpine*")
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 1))
Expect(search.OutputToString()).To(ContainSubstring("alpine"))
})
It("podman search repository tags", func() {
registryAddress, srv, serverErr := CreateMockRegistryServer()
defer CloseMockRegistryServer(srv, serverErr)
search := podmanTest.PodmanExitCleanly("search", "--list-tags", "--limit", "30", "--tls-verify=false", registryAddress+"/podman/stable")
Expect(search.OutputToStringArray()).To(HaveLen(31))
search = podmanTest.PodmanExitCleanly("search", "--list-tags", "--tls-verify=false", registryAddress+"/podman/stable")
Expect(len(search.OutputToStringArray())).To(BeNumerically(">", 2))
search = podmanTest.Podman([]string{"search", "--filter=is-official", "--list-tags", "--tls-verify=false", registryAddress + "/podman/stable"})
search.WaitWithDefaultTimeout()
Expect(search).To(ExitWithError(125, "filters are not applicable to list tags result"))
// With trailing slash
search = podmanTest.Podman([]string{"search", "--list-tags", "--tls-verify=false", registryAddress + "/podman/"})
search.WaitWithDefaultTimeout()
Expect(search).To(ExitWithError(125, `reference "podman/" must be a docker reference`))
Expect(search.OutputToStringArray()).To(BeEmpty())
// No trailing slash
search = podmanTest.Podman([]string{"search", "--list-tags", "--tls-verify=false", registryAddress + "/podman"})
search.WaitWithDefaultTimeout()
Expect(search).To(ExitWithError(125, "getting repository tags: fetching tags list: StatusCode: 404"))
Expect(search.OutputToStringArray()).To(BeEmpty())
})
It("podman search with limit over 100", func() {
registryAddress, srv, serverErr := CreateMockRegistryServer()
defer CloseMockRegistryServer(srv, serverErr)
search := podmanTest.PodmanExitCleanly("search", "--limit", "100", "--tls-verify=false", registryAddress+"/podman")
Expect(len(search.OutputToStringArray())).To(BeNumerically("<=", 101))
})
}) })