From d8f2cb862290895a25383485bebbca1b08f79c95 Mon Sep 17 00:00:00 2001 From: haircommander Date: Fri, 15 Jun 2018 19:41:00 -0400 Subject: TLS verify is skipped per registry. Signed-off-by: haircommander Closes: #952 Approved by: rhatdan --- test/e2e/search_test.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'test/e2e/search_test.go') diff --git a/test/e2e/search_test.go b/test/e2e/search_test.go index 96e1422ed..7cd877db6 100644 --- a/test/e2e/search_test.go +++ b/test/e2e/search_test.go @@ -29,6 +29,13 @@ var _ = Describe("Podman search", func() { # empty [registries.insecure] registries = []` + + const regFileContents2 = ` + [registries.search] + registries = ['localhost:5000', 'localhost:6000'] + + [registries.insecure] + registries = ['localhost:5000']` BeforeEach(func() { tempdir, err = CreateTempDirInTempDir() if err != nil { @@ -240,4 +247,42 @@ var _ = Describe("Podman search", func() { // cleanup os.Setenv("REGISTRIES_CONFIG_PATH", "") }) + + It("podman search doesn't attempt HTTP if one registry is not listed as insecure", func() { + registry := podmanTest.Podman([]string{"run", "-d", "-p", "5000:5000", "--name", "registry7", "registry:2"}) + registry.WaitWithDefaultTimeout() + Expect(registry.ExitCode()).To(Equal(0)) + + if !WaitContainerReady(&podmanTest, "registry7", "listening on", 20, 1) { + Skip("Can not start docker registry.") + } + + registry = podmanTest.Podman([]string{"run", "-d", "-p", "6000:5000", "--name", "registry8", "registry:2"}) + registry.WaitWithDefaultTimeout() + Expect(registry.ExitCode()).To(Equal(0)) + + if !WaitContainerReady(&podmanTest, "registry8", "listening on", 20, 1) { + Skip("Can not start docker registry.") + } + push := podmanTest.Podman([]string{"push", "--tls-verify=false", "--remove-signatures", ALPINE, "localhost:6000/my-alpine"}) + push.WaitWithDefaultTimeout() + Expect(push.ExitCode()).To(Equal(0)) + + // registries.conf set up + regFileBytes := []byte(regFileContents2) + outfile := filepath.Join(podmanTest.TempDir, "registries.conf") + os.Setenv("REGISTRIES_CONFIG_PATH", outfile) + ioutil.WriteFile(outfile, regFileBytes, 0644) + + search := podmanTest.Podman([]string{"search", "my-alpine"}) + search.WaitWithDefaultTimeout() + + Expect(search.ExitCode()).To(Equal(0)) + Expect(search.OutputToString()).Should(BeEmpty()) + match, _ := search.ErrorGrepString("error") + Expect(match).Should(BeTrue()) + + // cleanup + os.Setenv("REGISTRIES_CONFIG_PATH", "") + }) }) -- cgit v1.2.3-54-g00ecf