Skip to content

Commit

Permalink
testutil: Mark test helper functions (#11626)
Browse files Browse the repository at this point in the history
Our Go kubernetes test helpers take a testing.T without calling
t.Helper() to ignore the stack frame.

This change adds t.Helper() so that failure annotations will mark the
relevant test instead of the helper.
  • Loading branch information
olix0r authored Nov 17, 2023
1 parent 78a5ec5 commit 71cc411
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions testutil/kubernetes_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,15 @@ func (h *KubernetesHelper) URLFor(ctx context.Context, namespace, deployName str
// WaitRollout blocks until all the given deployments have been completely
// rolled out (and their pods are ready)
func (h *KubernetesHelper) WaitRollout(t *testing.T, deploys map[string]DeploySpec) {
t.Helper()
// Use default context
h.WaitRolloutWithContext(t, deploys, h.k8sContext)
}

// WaitRolloutWithContext blocks until all the given deployments in a provided
// k8s context have been completely rolled out (and their pods are ready)
func (h *KubernetesHelper) WaitRolloutWithContext(t *testing.T, deploys map[string]DeploySpec, context string) {
t.Helper()
for deploy, deploySpec := range deploys {
stat, err := h.KubectlWithContext("", context, "--namespace="+deploySpec.Namespace,
"rollout", "status", "--timeout=5m", "deploy/"+deploy)
Expand Down

0 comments on commit 71cc411

Please sign in to comment.