Merge pull request #106001 from NikhilSharmaWe/betterOutputKubectl

Changed code to improve output for files under test/e2e/kubectl
This commit is contained in:
Kubernetes Prow Robot 2021-11-02 09:20:58 -07:00 committed by GitHub
commit d8b6dc3e06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -505,7 +505,9 @@ var _ = SIGDescribe("Kubectl client", func() {
ginkgo.It("execing into a container with a failing command", func() { ginkgo.It("execing into a container with a failing command", func() {
_, err := framework.NewKubectlCommand(ns, "exec", "httpd", podRunningTimeoutArg, "--", "/bin/sh", "-c", "exit 42").Exec() _, err := framework.NewKubectlCommand(ns, "exec", "httpd", podRunningTimeoutArg, "--", "/bin/sh", "-c", "exit 42").Exec()
ee, ok := err.(uexec.ExitError) ee, ok := err.(uexec.ExitError)
framework.ExpectEqual(ok, true) if !ok {
framework.Failf("Got unexpected error type, expected uexec.ExitError, got %T: %v", err, err)
}
framework.ExpectEqual(ee.ExitStatus(), 42) framework.ExpectEqual(ee.ExitStatus(), 42)
}) })
@ -517,7 +519,9 @@ var _ = SIGDescribe("Kubectl client", func() {
ginkgo.It("running a failing command", func() { ginkgo.It("running a failing command", func() {
_, err := framework.NewKubectlCommand(ns, "run", "-i", "--image="+busyboxImage, "--restart=Never", podRunningTimeoutArg, "failure-1", "--", "/bin/sh", "-c", "exit 42").Exec() _, err := framework.NewKubectlCommand(ns, "run", "-i", "--image="+busyboxImage, "--restart=Never", podRunningTimeoutArg, "failure-1", "--", "/bin/sh", "-c", "exit 42").Exec()
ee, ok := err.(uexec.ExitError) ee, ok := err.(uexec.ExitError)
framework.ExpectEqual(ok, true) if !ok {
framework.Failf("Got unexpected error type, expected uexec.ExitError, got %T: %v", err, err)
}
framework.ExpectEqual(ee.ExitStatus(), 42) framework.ExpectEqual(ee.ExitStatus(), 42)
}) })
@ -526,7 +530,9 @@ var _ = SIGDescribe("Kubectl client", func() {
WithStdinData("abcd1234"). WithStdinData("abcd1234").
Exec() Exec()
ee, ok := err.(uexec.ExitError) ee, ok := err.(uexec.ExitError)
framework.ExpectEqual(ok, true) if !ok {
framework.Failf("Got unexpected error type, expected uexec.ExitError, got %T: %v", err, err)
}
if !strings.Contains(ee.String(), "timed out") { if !strings.Contains(ee.String(), "timed out") {
framework.Failf("Missing expected 'timed out' error, got: %#v", ee) framework.Failf("Missing expected 'timed out' error, got: %#v", ee)
} }
@ -537,7 +543,9 @@ var _ = SIGDescribe("Kubectl client", func() {
WithStdinData("abcd1234"). WithStdinData("abcd1234").
Exec() Exec()
ee, ok := err.(uexec.ExitError) ee, ok := err.(uexec.ExitError)
framework.ExpectEqual(ok, true) if !ok {
framework.Failf("Got unexpected error type, expected uexec.ExitError, got %T: %v", err, err)
}
if !strings.Contains(ee.String(), "timed out") { if !strings.Contains(ee.String(), "timed out") {
framework.Failf("Missing expected 'timed out' error, got: %#v", ee) framework.Failf("Missing expected 'timed out' error, got: %#v", ee)
} }