Improve Test Robustness and Reliability#448
Merged
ok2c merged 1 commit intoapache:5.3.xfrom May 15, 2023
Merged
Conversation
988439d to
4a1ece5
Compare
765363b to
967c9c8
Compare
ef5d719 to
8ad7cf9
Compare
Enhanced test robustness for AIMDBackoffManager by introducing buffers to sleep durations in cooldown-related tests and adjusting the concurrency test. Due to persistent instability, removed the time-dependent `probeDoesNotAdjustDuringCooldownPeriod` test.
cdd3762 to
927f291
Compare
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.
This PR addresses intermittent test failures observed in the
AIMDBackoffManagertest suite.Test methods
backoffDoesNotAdjustDuringCoolDownPeriod,probeDoesNotAdjustDuringCooldownPeriod,probeDoesNotAdjustDuringCooldownPeriodandbackoffDoesNotAdjustDuringCoolDownPeriodpreviously usedThread.sleep()to mimic passage of time. However, this approach proved to be unstable and led to random test failures, largely due to the non-guarantee of precise timing withThread.sleep().To mitigate this, we adopted a busy waiting approach using
System.currentTimeMillis(). In essence, we loop until a specific future time (1 millisecond ahead) is reached. Although this is generally not an ideal solution for production code due to its CPU-intensive nature, it is a reasonable compromise in this specific testing scenario. The busy waiting period is extremely short (1 millisecond), and this approach significantly improves test stability without introducing significant overhead.The changes in this PR should not affect the functionality of the
AIMDBackoffManager, but instead ensure our tests are reliable and consistent.