Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🤖 Sync from open-cluster-management-io/governance-policy-propagator: #186 #576

Merged
merged 2 commits into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions test/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func GetClusterLevelWithTimeout(
}

return nil
}, timeout, 1).Should(BeNil())
}, timeout, 1).ShouldNot(HaveOccurred())

if wantFound {
return obj
Expand Down Expand Up @@ -202,7 +202,7 @@ func GetWithTimeout(
}

return nil
}, timeout, 1).Should(BeNil())
}, timeout, 1).ShouldNot(HaveOccurred())

if wantFound {
return obj
Expand Down Expand Up @@ -239,7 +239,7 @@ func ListWithTimeout(
}

return nil
}, timeout, 1).Should(BeNil())
}, timeout, 1).ShouldNot(HaveOccurred())

if wantFound {
return list
Expand Down Expand Up @@ -277,7 +277,7 @@ func ListWithTimeoutByNamespace(
}

return nil
}, timeout, 1).Should(BeNil())
}, timeout, 1).ShouldNot(HaveOccurred())

if wantFound {
return list
Expand All @@ -298,11 +298,14 @@ func Kubectl(args ...string) {

// KubectlWithOutput execute kubectl cli and return output and error
func KubectlWithOutput(args ...string) (string, error) {
output, err := exec.Command("kubectl", args...).CombinedOutput()
//nolint:forbidigo
fmt.Println(string(output))
kubectlCmd := exec.Command("kubectl", args...)

output, err := kubectlCmd.CombinedOutput()
if err != nil {
return string(output), fmt.Errorf("error running kubectl command: %s: %s", output, err.Error())
}

return string(output), err
return string(output), nil
}

// GetMetrics execs into the propagator pod and curls the metrics endpoint, filters
Expand Down
Loading