mirror of
https://github.com/containers/podman.git
synced 2025-06-24 19:42:56 +08:00
e2e cleanup: push with auth: add error checks
Add actual tests (for expected errors, not just exit-status) to the "push to local registry with authorization" test. As it is now, if the registry is unreachable, the test passes a number of steps and only fails later, with a misleading diagnostic. Followup to, but does not fix, #18286 Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -286,10 +286,12 @@ var _ = Describe("Podman push", func() {
|
|||||||
push := podmanTest.Podman([]string{"push", "--tls-verify=true", "--format=v2s2", "--creds=podmantest:test", ALPINE, "localhost:5000/tlstest"})
|
push := podmanTest.Podman([]string{"push", "--tls-verify=true", "--format=v2s2", "--creds=podmantest:test", ALPINE, "localhost:5000/tlstest"})
|
||||||
push.WaitWithDefaultTimeout()
|
push.WaitWithDefaultTimeout()
|
||||||
Expect(push).To(ExitWithError())
|
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 = podmanTest.Podman([]string{"push", "--creds=podmantest:test", "--tls-verify=false", ALPINE, "localhost:5000/tlstest"})
|
||||||
push.WaitWithDefaultTimeout()
|
push.WaitWithDefaultTimeout()
|
||||||
Expect(push).Should(Exit(0))
|
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"})
|
setup := SystemExec("cp", []string{filepath.Join(certPath, "domain.crt"), "/etc/containers/certs.d/localhost:5000/ca.crt"})
|
||||||
Expect(setup).Should(Exit(0))
|
Expect(setup).Should(Exit(0))
|
||||||
@ -297,17 +299,20 @@ var _ = Describe("Podman push", func() {
|
|||||||
push = podmanTest.Podman([]string{"push", "--creds=podmantest:wrongpasswd", ALPINE, "localhost:5000/credstest"})
|
push = podmanTest.Podman([]string{"push", "--creds=podmantest:wrongpasswd", ALPINE, "localhost:5000/credstest"})
|
||||||
push.WaitWithDefaultTimeout()
|
push.WaitWithDefaultTimeout()
|
||||||
Expect(push).To(ExitWithError())
|
Expect(push).To(ExitWithError())
|
||||||
|
Expect(push.ErrorToString()).To(ContainSubstring("/credstest: authentication required"))
|
||||||
|
|
||||||
if !IsRemote() {
|
if !IsRemote() {
|
||||||
// remote does not support --cert-dir
|
// 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 = podmanTest.Podman([]string{"push", "--tls-verify=true", "--creds=podmantest:test", "--cert-dir=fakedir", ALPINE, "localhost:5000/certdirtest"})
|
||||||
push.WaitWithDefaultTimeout()
|
push.WaitWithDefaultTimeout()
|
||||||
Expect(push).To(ExitWithError())
|
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 = podmanTest.Podman([]string{"push", "--creds=podmantest:test", ALPINE, "localhost:5000/defaultflags"})
|
||||||
push.WaitWithDefaultTimeout()
|
push.WaitWithDefaultTimeout()
|
||||||
Expect(push).Should(Exit(0))
|
Expect(push).Should(Exit(0))
|
||||||
|
Expect(push.ErrorToString()).To(ContainSubstring("Writing manifest to image destination"))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman push and encrypt to oci", func() {
|
It("podman push and encrypt to oci", func() {
|
||||||
|
Reference in New Issue
Block a user