Skip to content

Commit 5af1a7a

Browse files
committed
tests: Fix timing race in legacy ConfigMap upgrade test
The test for legacy ConfigMap migration was failing due to a timing race condition. The MAC entry was becoming stale too quickly (after 1 minute) before the test could verify the "occupied" state. Changed the stale timeout from 1 minute to 3 minutes in simulateSoonToBeStaleEntryInConfigMap() to give the test sufficient time. Signed-off-by: Ram Lavi <ralavi@redhat.com>
1 parent 51fa973 commit 5af1a7a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/tests.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,9 @@ func simulateSoonToBeStaleEntryInConfigMap(macAddress string) error {
431431
vmWaitConfigMap.Data = map[string]string{}
432432
}
433433
// legacy configMap uses time.RFC3339 format timestamps
434-
// This entry should go stale after 1 minute
435-
vmWaitConfigMap.Data[macAddressDashes] = time.Now().Add(-waitTime + time.Minute).Format(time.RFC3339)
434+
// This entry should go stale after 3 minutes
435+
staleAfterDuration := 3 * time.Minute
436+
vmWaitConfigMap.Data[macAddressDashes] = time.Now().Add(-waitTime + staleAfterDuration).Format(time.RFC3339)
436437
return nil
437438
})
438439

0 commit comments

Comments
 (0)