Skip to content

Commit 9aed01f

Browse files
committed
mhc: fix timing flake in tests
1 parent 87ed0eb commit 9aed01f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pkg/controller/machinehealthcheck/machinehealthcheck_controller_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3075,7 +3075,8 @@ func assertBaseReconcile(t *testing.T, tc testCase, ctx context.Context, r *Reco
30753075

30763076
if result != tc.expected.result {
30773077
if tc.expected.result.RequeueAfter > 0 {
3078-
before := tc.expected.result.RequeueAfter
3078+
// Allow 1 second tolerance on both sides to account for timing variations during test execution
3079+
before := tc.expected.result.RequeueAfter - time.Second
30793080
after := tc.expected.result.RequeueAfter + time.Second
30803081
if after < result.RequeueAfter || before > result.RequeueAfter {
30813082
t.Errorf("Test case: %s. Expected RequeueAfter between: %v and %v, got: %v", tc.node.Name, before, after, result)

0 commit comments

Comments
 (0)