Repository navigation
fix: stabilize flaky failover attempts test - #4482
Conversation
|
Hi, Iβm Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset. In case there are security findings, they will be communicated to you as a comment inside the PR. Hope youβll enjoy using Jit. Questions? Comments? Want to learn more? Get in touch with us. |
|
hey @Ra9huvansh , thanks for picking this up! |
|
hi @atakavci, yes indeed relying on just timing is fragile. What could be a better approach? Do you have anything in mind? Also sorry about the formatter, will make sure to run it before pushing next time. |
Fixes #4428
Problem
MultiDbConnectionProviderFailoverAttemptsConfigTest.delayBetweenFailoverAttempts_permanentExceptionAfterAttemptsExhaustedwas flaky in CI with: expected: <1> but was: <2>The test used a 20ms freeze window. The 50-iteration rapid loop could take longer than 20ms on a loaded CI machine, causing the freeze window to expire mid-loop. When that happened,
markAsFreeze()succeeded again and incrementedfailoverAttemptCountto 2, failing theassertEquals(1, ...)assertion.Fix
delayMsfrom 20ms to 200ms so the rapid loop always completes within the freeze windowatMostfrom 200ms to 2s proportionally, since theawait()block must wait for the (now longer) freeze window to expirepollIntervalfrom 10ms to 50ms accordinglyimport org.awaitility.DurationsNo production code changes.
Note
Low Risk
Low risk: test-only timing adjustments to reduce CI flakiness; no production logic changes.
Overview
Stabilizes
MultiDbConnectionProviderFailoverAttemptsConfigTest.delayBetweenFailoverAttempts_permanentExceptionAfterAttemptsExhaustedby widening the failover delay window (20ms οΏ½ 200ms) so the rapid retry loop stays within the freeze period.Updates the Awaitility wait/poll timings to match the longer window and removes the unused
org.awaitility.Durationsimport.Reviewed by Cursor Bugbot for commit bc24549. Bugbot is set up for automated code reviews on this repo. Configure here.