Skip to content

Improve Test Robustness and Reliability#448

Merged
ok2c merged 1 commit intoapache:5.3.xfrom
arturobernalg:feature/backoff-test
May 15, 2023
Merged

Improve Test Robustness and Reliability#448
ok2c merged 1 commit intoapache:5.3.xfrom
arturobernalg:feature/backoff-test

Conversation

@arturobernalg
Copy link
Copy Markdown
Member

@arturobernalg arturobernalg commented May 14, 2023

This PR addresses intermittent test failures observed in the AIMDBackoffManager test suite.

Test methods backoffDoesNotAdjustDuringCoolDownPeriod, probeDoesNotAdjustDuringCooldownPeriod , probeDoesNotAdjustDuringCooldownPeriod and backoffDoesNotAdjustDuringCoolDownPeriod previously used Thread.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 with Thread.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.

@arturobernalg arturobernalg marked this pull request as draft May 15, 2023 04:52
@arturobernalg arturobernalg force-pushed the feature/backoff-test branch from 988439d to 4a1ece5 Compare May 15, 2023 08:01
@arturobernalg arturobernalg marked this pull request as ready for review May 15, 2023 09:21
@arturobernalg arturobernalg force-pushed the feature/backoff-test branch 3 times, most recently from 765363b to 967c9c8 Compare May 15, 2023 13:42
@arturobernalg arturobernalg marked this pull request as draft May 15, 2023 13:46
@arturobernalg arturobernalg force-pushed the feature/backoff-test branch from ef5d719 to 8ad7cf9 Compare May 15, 2023 16:50
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.
@arturobernalg arturobernalg force-pushed the feature/backoff-test branch from cdd3762 to 927f291 Compare May 15, 2023 16:58
@arturobernalg arturobernalg marked this pull request as ready for review May 15, 2023 18:44
@ok2c ok2c merged commit 354c7c1 into apache:5.3.x May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants