From c1580e960d3d81339902b6e439c8b8bdf13665e1 Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Sun, 18 Dec 2022 12:36:04 +0000 Subject: [PATCH] e2e kubectl test cleanup the test uses a BeforeEach block to create a pod with the name defined but the simplePodName variables, however, some test use the value of the variable directly. To avoid future problems use the variable name instead of the value on all tests. Change-Id: I21a01019d91fe5ae7e35566184420001978ce355 --- test/e2e/kubectl/kubectl.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/e2e/kubectl/kubectl.go b/test/e2e/kubectl/kubectl.go index 3006df523c2..390835d73d3 100644 --- a/test/e2e/kubectl/kubectl.go +++ b/test/e2e/kubectl/kubectl.go @@ -480,7 +480,7 @@ var _ = SIGDescribe("Kubectl client", func() { for _, proxyVar := range []string{"https_proxy", "HTTPS_PROXY"} { proxyLogs.Reset() ginkgo.By("Running kubectl via an HTTP proxy using " + proxyVar) - output := e2ekubectl.NewKubectlCommand(ns, "exec", podRunningTimeoutArg, "httpd", "--", "echo", "running", "in", "container"). + output := e2ekubectl.NewKubectlCommand(ns, "exec", podRunningTimeoutArg, simplePodName, "--", "echo", "running", "in", "container"). WithEnv(append(os.Environ(), fmt.Sprintf("%s=%s", proxyVar, proxyAddr))). ExecOrDie(ns) @@ -516,7 +516,7 @@ var _ = SIGDescribe("Kubectl client", func() { ginkgo.By("Running kubectl via kubectl proxy using " + host) output := e2ekubectl.NewKubectlCommand( ns, host, - "exec", podRunningTimeoutArg, "httpd", "--", "echo", "running", "in", "container", + "exec", podRunningTimeoutArg, simplePodName, "--", "echo", "running", "in", "container", ).ExecOrDie(ns) // Verify we got the normal output captured by the exec server @@ -528,12 +528,12 @@ var _ = SIGDescribe("Kubectl client", func() { ginkgo.Context("should return command exit codes", func() { ginkgo.It("execing into a container with a successful command", func(ctx context.Context) { - _, err := e2ekubectl.NewKubectlCommand(ns, "exec", "httpd", podRunningTimeoutArg, "--", "/bin/sh", "-c", "exit 0").Exec() + _, err := e2ekubectl.NewKubectlCommand(ns, "exec", simplePodName, podRunningTimeoutArg, "--", "/bin/sh", "-c", "exit 0").Exec() framework.ExpectNoError(err) }) ginkgo.It("execing into a container with a failing command", func(ctx context.Context) { - _, err := e2ekubectl.NewKubectlCommand(ns, "exec", "httpd", podRunningTimeoutArg, "--", "/bin/sh", "-c", "exit 42").Exec() + _, err := e2ekubectl.NewKubectlCommand(ns, "exec", simplePodName, podRunningTimeoutArg, "--", "/bin/sh", "-c", "exit 42").Exec() ee, ok := err.(uexec.ExitError) if !ok { framework.Failf("Got unexpected error type, expected uexec.ExitError, got %T: %v", err, err)