Skip to content

Commit

Permalink
Improve output of exec.KubectlApply
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Büringer buringerst@vmware.com
  • Loading branch information
sbueringer committed Nov 20, 2023
1 parent 2e8d738 commit f817db2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/framework/exec/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"context"
"fmt"
"os"
"strings"
)

// KubectlApply shells out to kubectl apply.
Expand All @@ -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
}

Expand Down

0 comments on commit f817db2

Please sign in to comment.