Skip to content

test: replace Thread.sleep with Awaitility in integration tests#823

Open
dkropachev wants to merge 1 commit intoscylladb:scylla-4.xfrom
dkropachev:replace-thread-sleep-with-awaitility
Open

test: replace Thread.sleep with Awaitility in integration tests#823
dkropachev wants to merge 1 commit intoscylladb:scylla-4.xfrom
dkropachev:replace-thread-sleep-with-awaitility

Conversation

@dkropachev
Copy link

@dkropachev dkropachev commented Mar 1, 2026

Summary

  • Replace fixed Thread.sleep calls with Awaitility polling in integration tests
  • Affected tests: MetricsITBase, DefaultMetadataTabletMapIT, MockResolverIT
  • DriverBlockHoundIntegrationIT left unchanged (intentional sleep for BlockHound)
  • Eliminates wasted wait time by polling for expected conditions

Test plan

  • All modified tests pass locally
  • CI integration tests pass with no regressions

@dkropachev dkropachev self-assigned this Mar 1, 2026
Replace fixed Thread.sleep calls with Awaitility's polling-based
waiting in MetricsITBase, DefaultMetadataTabletMapIT, and
MockResolverIT. This eliminates wasted wait time by polling for
the expected condition instead of sleeping for a fixed duration.

DriverBlockHoundIntegrationIT is left unchanged as its sleep is
intentional for BlockHound testing.
@dkropachev dkropachev force-pushed the replace-thread-sleep-with-awaitility branch from a26bd19 to e4e685b Compare March 1, 2026 23:19
@dkropachev dkropachev requested a review from nikagra March 1, 2026 23:30
@dkropachev dkropachev marked this pull request as ready for review March 2, 2026 03:07
.pollInterval(Duration.ofMillis(50))
.until(() -> isSessionLearnedTabletInfo(session));
return true;
} catch (org.awaitility.core.ConditionTimeoutException e) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we import this as well?

.atMost(Duration.ofSeconds(CLUSTER_WAIT_SECONDS))
.pollInterval(Duration.ofSeconds(1))
.until(() -> countUpNodes(firstSession) == numberOfNodes);
} catch (org.awaitility.core.ConditionTimeoutException e) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

.atMost(Duration.ofSeconds(CLUSTER_WAIT_SECONDS))
.pollInterval(Duration.ofSeconds(1))
.until(() -> countUpNodes(session) == numberOfNodes);
} catch (org.awaitility.core.ConditionTimeoutException e) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📍

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