Skip to content

Commit f9b6a48

Browse files
committed
Fix race condition in TestPatchHelper test
Signed-off-by: Stefan Büringer [email protected]
1 parent 3e47858 commit f9b6a48

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)