From 6b58105a528df14cf1ac4a16b83947efa060adb2 Mon Sep 17 00:00:00 2001 From: Kashif Khan Date: Thu, 2 Jan 2025 13:19:19 +0200 Subject: [PATCH] Fix metrics service validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the cmd block is outside the eventually block, when the same cmd object is used multiple times, we see ´exec: Stdout already set´ error. Moving it inside the eventually block should solve it. Signed-off-by: Kashif Khan --- test/e2e/e2e_suite_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 095140ccf4..4acc4dad19 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -238,15 +238,15 @@ var _ = SynchronizedBeforeSuite(func() []byte { Expect(err).NotTo(HaveOccurred(), "Failed to create ClusterRoleBinding") By("validating that the metrics service is available") - cmd = exec.Command("kubectl", "get", "service", metricsServiceName, "-n", namespace) Eventually(func() error { + cmd := exec.Command("kubectl", "get", "service", metricsServiceName, "-n", namespace) output, err := cmd.CombinedOutput() if err != nil { - fmt.Printf("Command output: %s\n", string(output)) + fmt.Printf("Service check output: %s\n", string(output)) return err } return nil - }, "30s", "5s").Should(Succeed()) + }, "30s", "5s").Should(Succeed(), "Metrics service is not available") By("getting the service account token") token, err := serviceAccountToken()