From f817db2b4973891179582ec0e756a16c6bee6a39 Mon Sep 17 00:00:00 2001 From: Stefan Bueringer Date: Mon, 20 Nov 2023 17:09:58 +0100 Subject: [PATCH] Improve output of exec.KubectlApply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Büringer buringerst@vmware.com --- test/framework/exec/kubectl.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/framework/exec/kubectl.go b/test/framework/exec/kubectl.go index 0b3069348cd4..15f2808832e8 100644 --- a/test/framework/exec/kubectl.go +++ b/test/framework/exec/kubectl.go @@ -21,6 +21,7 @@ import ( "context" "fmt" "os" + "strings" ) // KubectlApply shells out to kubectl apply. @@ -34,12 +35,14 @@ func KubectlApply(ctx context.Context, kubeconfigPath string, resources []byte, WithArgs(aargs...), WithStdin(rbytes), ) + + fmt.Printf("Running kubectl %s\n", strings.Join(aargs, " ")) stdout, stderr, err := applyCmd.Run(ctx) + fmt.Printf("stderr:\n%s\n", string(stderr)) + fmt.Printf("stdout:\n%s\n", string(stdout)) if err != nil { - fmt.Println(string(stderr)) return err } - fmt.Println(string(stdout)) return nil }