Skip to content

Commit

Permalink
Merge pull request containers#18361 from edsantiago/push_test_cleanup
Browse files Browse the repository at this point in the history
e2e cleanup: push with auth: add error checks
  • Loading branch information
openshift-merge-robot authored Apr 30, 2023
2 parents 19152fa + a027bf1 commit 0429b68
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/e2e/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,28 +286,33 @@ var _ = Describe("Podman push", func() {
push := podmanTest.Podman([]string{"push", "--tls-verify=true", "--format=v2s2", "--creds=podmantest:test", ALPINE, "localhost:5000/tlstest"})
push.WaitWithDefaultTimeout()
Expect(push).To(ExitWithError())
Expect(push.ErrorToString()).To(ContainSubstring("x509: certificate signed by unknown authority"))

push = podmanTest.Podman([]string{"push", "--creds=podmantest:test", "--tls-verify=false", ALPINE, "localhost:5000/tlstest"})
push.WaitWithDefaultTimeout()
Expect(push).Should(Exit(0))
Expect(push.ErrorToString()).To(ContainSubstring("Writing manifest to image destination"))

setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), "/etc/containers/certs.d/localhost:5000/ca.crt"})
Expect(setup).Should(Exit(0))

push = podmanTest.Podman([]string{"push", "--creds=podmantest:wrongpasswd", ALPINE, "localhost:5000/credstest"})
push.WaitWithDefaultTimeout()
Expect(push).To(ExitWithError())
Expect(push.ErrorToString()).To(ContainSubstring("/credstest: authentication required"))

if !IsRemote() {
// remote does not support --cert-dir
push = podmanTest.Podman([]string{"push", "--tls-verify=true", "--creds=podmantest:test", "--cert-dir=fakedir", ALPINE, "localhost:5000/certdirtest"})
push.WaitWithDefaultTimeout()
Expect(push).To(ExitWithError())
Expect(push.ErrorToString()).To(ContainSubstring("x509: certificate signed by unknown authority"))
}

push = podmanTest.Podman([]string{"push", "--creds=podmantest:test", ALPINE, "localhost:5000/defaultflags"})
push.WaitWithDefaultTimeout()
Expect(push).Should(Exit(0))
Expect(push.ErrorToString()).To(ContainSubstring("Writing manifest to image destination"))
})

It("podman push and encrypt to oci", func() {
Expand Down

0 comments on commit 0429b68

Please sign in to comment.