From 3b415f2955d6ea26e6ffaeef0a41c63d8c0f7f41 Mon Sep 17 00:00:00 2001 From: Shubham Gupta Date: Fri, 15 Sep 2023 20:53:26 +0530 Subject: [PATCH] fix changes Signed-off-by: Shubham Gupta --- pkg/test/utils/kubernetes.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/test/utils/kubernetes.go b/pkg/test/utils/kubernetes.go index b6b0c12f..e1f7e20c 100644 --- a/pkg/test/utils/kubernetes.go +++ b/pkg/test/utils/kubernetes.go @@ -1039,7 +1039,10 @@ func RunCommand(ctx context.Context, namespace string, cmd harness.Command, cwd if err != nil { return nil, fmt.Errorf("command %q with %w", cmd.Command, err) } - + // Check if command is running in background and has an output validation + if cmd.Background && cmd.Output != nil { + return nil, errors.New("background commands cannot have an output validation") + } kuttlENV := make(map[string]string) kuttlENV["NAMESPACE"] = namespace kuttlENV["KUBECONFIG"] = kubeconfigPath(actualDir, kubeconfigOverride) @@ -1113,10 +1116,7 @@ func RunCommand(ctx context.Context, namespace string, cmd harness.Command, cwd } if cmd.Output != nil { - err1 := cmd.Output.ValidateCommandOutput(stdoutOutput, stderrOutput) - if err1 != nil { - return nil, err1 - } + return nil, cmd.Output.ValidateCommandOutput(stdoutOutput, stderrOutput) } return nil, err }