Skip to content

Commit fda8713

Browse files
authored
Merge pull request #10886 from sbueringer/pr-fix-patch-helper-test
🐛 Fix race condition in TestPatchHelper test
2 parents 3e47858 + f9b6a48 commit fda8713

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

util/patch/patch_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,10 @@ func TestPatchHelper(t *testing.T) {
974974
g.Expect(env.Delete(ctx, cluster)).To(Succeed())
975975

976976
// Ensure cluster still exists & get Cluster with deletionTimestamp set
977-
g.Expect(env.Get(ctx, key, cluster)).To(Succeed())
977+
// Note: Using the APIReader to ensure we get the cluster with deletionTimestamp is set.
978+
// This is realistic because finalizers are removed in reconcileDelete code and that is only
979+
// run if the deletionTimestamp is set.
980+
g.Expect(env.GetAPIReader().Get(ctx, key, cluster)).To(Succeed())
978981

979982
// Patch helper will first remove the finalizer and then it will get a not found error when
980983
// trying to patch status. This test validates that the not found error is ignored.

0 commit comments

Comments
 (0)