Skip to content

Commit d2fd5c0

Browse files
authored
test: Add t.Helper() calls in nested tests (#1258)
This fixes incorrect line numbers being reported in test failures. This was discovered as noted in #1257 (comment).
1 parent b7bec08 commit d2fd5c0

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

common/pkg/k8s/parser/parser_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ func runUnstructuredTests(t *testing.T, fn func([]string) ([]client.Object, erro
141141
t.Parallel()
142142
for _, tt := range tests {
143143
t.Run(tt.name, func(t *testing.T) {
144+
t.Helper()
144145
t.Parallel()
145146
got, err := fn(tt.inputs)
146147
if tt.wantErr != "" {

common/pkg/testutils/capitest/variables.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ func ValidateDiscoverVariablesAs[V mutation.DiscoverVariables, T any](
7979

8080
for _, tt := range variableTestDefs {
8181
t.Run(tt.Name, func(t *testing.T) {
82+
t.Helper()
83+
8284
t.Parallel()
8385

8486
g := gomega.NewWithT(t)

0 commit comments

Comments
 (0)