From 6bf31ca27118739d24511da2c3a6443e81f6b129 Mon Sep 17 00:00:00 2001 From: Kyle Wuolle Date: Fri, 22 Nov 2024 12:30:17 -0800 Subject: [PATCH] Try to get output --- Makefile | 4 +++- test/e2e/e2e_suite_test.go | 8 ++++---- test/e2e/provider_aws_test.go | 4 ++-- test/e2e/provider_azure_test.go | 4 ++-- test/utils/utils.go | 3 +++ 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 9d09f0fe0..5d6574e97 100644 --- a/Makefile +++ b/Makefile @@ -139,7 +139,9 @@ test-e2e: cli-install @if [ "$$GINKGO_LABEL_FILTER" ]; then \ ginkgo_label_flag="-ginkgo.label-filter=$$GINKGO_LABEL_FILTER"; \ fi; \ - KIND_CLUSTER_NAME="hmc-test" KIND_VERSION=$(KIND_VERSION) go test ./test/e2e/ -v -ginkgo.v -ginkgo.timeout=3h -timeout=3h $$ginkgo_label_flag + KIND_CLUSTER_NAME="hmc-test" KIND_VERSION=$(KIND_VERSION) dlv test ./test/e2e/ --headless -l :2345 --only-same-user=false --log --api-version=2 --accept-multiclient -- -ginkgo.v + + #KIND_CLUSTER_NAME="hmc-test" KIND_VERSION=$(KIND_VERSION) go test ./test/e2e/ -v -ginkgo.v -ginkgo.timeout=3h -timeout=3h $$ginkgo_label_flag .PHONY: lint lint: golangci-lint ## Run golangci-lint linter & yamllint diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 1a80faf55..82b4a96fd 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -50,12 +50,12 @@ var _ = BeforeSuite(func() { By("building and deploying the controller-manager") cmd := exec.Command("make", "kind-deploy") - output, err := utils.Run(cmd) - _, _ = fmt.Fprintf(GinkgoWriter, "%s\n", output) + _, err := utils.Run(cmd) + //_, _ = fmt.Fprintf(GinkgoWriter, "%s\n", output) Expect(err).NotTo(HaveOccurred()) cmd = exec.Command("make", "test-apply") - output, err = utils.Run(cmd) - _, _ = fmt.Fprintf(GinkgoWriter, "%s\n", output) + _, err = utils.Run(cmd) + //_, _ = fmt.Fprintf(GinkgoWriter, "%s\n", output) Expect(err).NotTo(HaveOccurred()) By("validating that the hmc-controller and CAPI provider controllers are running and ready") diff --git a/test/e2e/provider_aws_test.go b/test/e2e/provider_aws_test.go index 481150f35..d5a86354a 100644 --- a/test/e2e/provider_aws_test.go +++ b/test/e2e/provider_aws_test.go @@ -107,8 +107,8 @@ var _ = Describe("AWS Templates", Label("provider:cloud", "provider:aws"), Order GinkgoT().Setenv("KUBECONFIG", kubeCfgPath) cmd := exec.Command("make", "test-apply") - output, err := utils.Run(cmd) - _, _ = fmt.Fprintf(GinkgoWriter, "%s\n", output) + _, err := utils.Run(cmd) + //_, _ = fmt.Fprintf(GinkgoWriter, "%s\n", output) Expect(err).NotTo(HaveOccurred()) Expect(os.Unsetenv("KUBECONFIG")).To(Succeed()) diff --git a/test/e2e/provider_azure_test.go b/test/e2e/provider_azure_test.go index df8194a4a..ea29cdaf3 100644 --- a/test/e2e/provider_azure_test.go +++ b/test/e2e/provider_azure_test.go @@ -108,8 +108,8 @@ var _ = Context("Azure Templates", Label("provider:cloud", "provider:azure"), Or By("Deploy onto standalone cluster") GinkgoT().Setenv("KUBECONFIG", kubeCfgPath) cmd := exec.Command("make", "test-apply") - output, err := utils.Run(cmd) - _, _ = fmt.Fprintf(GinkgoWriter, "%s\n", output) + _, err := utils.Run(cmd) + //_, _ = fmt.Fprintf(GinkgoWriter, "%s\n", output) Expect(err).NotTo(HaveOccurred()) Expect(os.Unsetenv("KUBECONFIG")).To(Succeed()) diff --git a/test/utils/utils.go b/test/utils/utils.go index 56ce5ee33..8f302c850 100644 --- a/test/utils/utils.go +++ b/test/utils/utils.go @@ -38,6 +38,9 @@ func Run(cmd *exec.Cmd) ([]byte, error) { command := prepareCmd(cmd) _, _ = fmt.Fprintf(GinkgoWriter, "running: %s\n", command) + cmd.Stdout = GinkgoWriter + cmd.Stderr = GinkgoWriter + output, err := cmd.Output() if err != nil { return nil, handleCmdError(err, command)