Replace Thread.sleep and Testing.whileTimeout with Awaitility in tests#8455
Merged
rzo1 merged 1 commit intoapache:masterfrom Mar 30, 2026
Merged
Conversation
Replace hand-rolled polling loops and Testing.whileTimeout calls with Awaitility across 6 test files. This makes async waits exit as soon as the condition is met instead of sleeping for a fixed duration, improving both test speed and reliability on slow CI machines. Files changed: - RocksDbStoreTest: polling loop in waitForInsertFinish - DRPCTest: deadline loop in getNextAvailableRequest - AsyncLocalizerTest: polling loop waiting for file deletion - AuthTest: Testing.whileTimeout waiting for ThriftServer - MetricsIntegrationTest: Testing.whileTimeout in waitForAtLeastNBuckets - NettyTest: waitUntilReady, waitForNotNull, doTestLoad, doTestBatch The deliberate Thread.sleep(100) in NettyTest.doTestServerDelayed is left unchanged as it simulates a delayed server start, not polling. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
reiabreu
approved these changes
Mar 30, 2026
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.
Summary
Thread.sleeppolling loops andTesting.whileTimeoutcalls with Awaitility across 6 test filesFiles changed
RocksDbStoreTestdo { Thread.sleep(1) } while (...)loop with manual attempt counterAwaitility.await().until(...)DRPCTestwhile (System.currentTimeMillis() < deadline)+Thread.sleep(1)Awaitility.await().until(...)AsyncLocalizerTestwhile (...) Thread.sleep(1)waiting for file deletionAwaitility.await().until(() -> !file.exists())AuthTestTesting.whileTimeout+Time.sleep(100)Awaitility.await().until(server::isServing)MetricsIntegrationTestTesting.whileTimeoutinwaitForAtLeastNBucketsAwaitility.with().until(...)(now consistent withassertMetricRunningSumwhich already used Awaitility)NettyTestsleep()helper, 3xTesting.whileTimeoutAwaitility.await().until(...)throughoutNot changed
ServerUtilsTest.sleepInterrupted()— intentionally tests thread interrupt behaviorNettyTest.doTestServerDelayedThread.sleep(100)— deliberate delay simulating a late server start, not pollingLocalFsBlobStoreTestThread.sleep(2)— waits for filesystem timestamp resolution, not a polling patternTest plan
RocksDbStoreTest— 4 tests passDRPCTest— 6 tests passAsyncLocalizerTest— 17 tests passAuthTest— 13 tests passMetricsIntegrationTest— 2 tests passNettyTest— 13 tests pass🤖 Generated with Claude Code