Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ linters:
- unused
- usetesting
- wastedassign
settings:
usetesting:
context-background: true
context-todo: true
Comment thread
coderabbitai[bot] marked this conversation as resolved.
exclusions:
generated: lax
presets:
Expand Down
9 changes: 4 additions & 5 deletions pkg/apply/apply_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package apply

import (
"context"
"fmt"
"testing"

Expand Down Expand Up @@ -58,7 +57,7 @@ func TestApplyObjectPrePatchRunsBeforeSSA(t *testing.T) {
names.PrePatchAnnotation: prePatchValue,
})

err := ApplyObject(context.Background(), client, obj, "test-controller")
err := ApplyObject(t.Context(), client, obj, "test-controller")
g.Expect(err).To(Succeed())
g.Expect(patchTypes).To(HaveLen(2))
g.Expect(patchTypes[0]).To(Equal(types.StrategicMergePatchType), "pre-patch should be strategic-merge-patch")
Expand All @@ -81,7 +80,7 @@ func TestApplyObjectPrePatchNotFoundAllowsSSA(t *testing.T) {
names.PrePatchAnnotation: prePatchValue,
})

err := ApplyObject(context.Background(), client, obj, "test-controller")
err := ApplyObject(t.Context(), client, obj, "test-controller")
g.Expect(err).To(Succeed())
g.Expect(patchTypes).To(HaveLen(2))
g.Expect(patchTypes[0]).To(Equal(types.StrategicMergePatchType), "pre-patch was attempted")
Expand All @@ -103,7 +102,7 @@ func TestApplyObjectPrePatchErrorStopsReconciliation(t *testing.T) {
names.PrePatchAnnotation: prePatchValue,
})

err := ApplyObject(context.Background(), client, obj, "test-controller")
err := ApplyObject(t.Context(), client, obj, "test-controller")
g.Expect(err).To(HaveOccurred())
g.Expect(err.Error()).To(ContainSubstring("failed to pre-patch"))
g.Expect(patchTypes).To(HaveLen(1), "SSA apply should not have been reached")
Expand All @@ -123,7 +122,7 @@ func TestApplyObjectNoPrePatchAnnotationSkipsPrePatch(t *testing.T) {

obj := newTestDeployment(nil)

err := ApplyObject(context.Background(), client, obj, "test-controller")
err := ApplyObject(t.Context(), client, obj, "test-controller")
g.Expect(err).To(Succeed())
g.Expect(patchTypes).To(HaveLen(1))
g.Expect(patchTypes[0]).To(Equal(types.ApplyPatchType), "only SSA apply should have run")
Expand Down
Loading