fix(test): fix timing flakes in ChronometerTest and ThroughputControlTestCase#678
Merged
fix(test): fix timing flakes in ChronometerTest and ThroughputControlTestCase#678
Conversation
…TestCase ChronometerTest: - Add @BeforeAll warmUp() (5 × sleep(20) iterations) to prime JVM timer threads before the actual assertions run - Increase TOLERANCE 200ms → 1000ms to absorb OS scheduler jitter when running the full suite under load; still reliably catches real bugs (elapsed returning 0, wrong units, negative values, etc.) ThroughputControlTestCase.testFifty: - Widen upper bound 4500ms → 6000ms; 10 tps × 50 tx guarantees exactly 4000ms minimum but the 500ms ceiling was too tight on a loaded machine (failed at 4586ms)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ChronometerTest
@BeforeAll warmUp()— 5 ×sleep(20)+elapsed()/lap()iterations to prime JVM timer threads before assertions runTOLERANCE200 ms → 1000 ms to absorb OS scheduler jitter when running under a loaded full-suite build; still reliably catches real bugs (elapsed returning 0, wrong units, negative values, etc.)Root cause:
Thread.sleep(25)measured 300–440 ms on a cold JVM due to timer-thread initialisation. Warmup alone is insufficient under full test-suite load (parallel worker contention), hence the wider ceiling.ThroughputControlTestCase.testFifty
The minimum (4000 ms for 10 tps × 50 tx) is deterministic; the 500 ms ceiling was too tight on a loaded machine (failed at 4586 ms).