Replace Thread.sleep with Wait.waitFor in FailoverClusterTest#1679
Replace Thread.sleep with Wait.waitFor in FailoverClusterTest#1679jeanouii wants to merge 1 commit intoapache:mainfrom
Conversation
Thread.sleep(3000) is unreliable on slow CI machines for waiting on cluster formation and client rebalancing. Replace all sleep-based synchronization with Wait.waitFor polling: - testClusterConnectedAfterClients: poll for clients on multiple brokers - testClusterURIOptionsStrip: same polling for client rebalance - testClusterConnectedBeforeClients: poll for bridge formation, then poll for client failover after broker stop This also fixes AutoFailoverClusterTest which inherits these methods.
|
Hi @jeanouii, I am an Outreachy applicant for the May 2026 cohort and a Java developer. I’ve been exploring the codebase and I see you are replacing Thread.sleep with Wait.waitFor in FailoverClusterTest. Could you please guide me if I can take this up or if there’s a similar 'Good First Issue' I can start with? I'm eager to make my initial contributions! |
|
Hi, First, thank you for showing up and be eager to help. I've started the same way, all of us pretty much. My usual approach is to monitor the builds (quick, nightly, or on-demand) on Github Actions and then create an issue to start investigating. Most of the time it's a race condition (Thread.sleep or similar). The test needs fixing. I've seen a few issues in the production code, but not much. If you want to look at the test failures and send an email to dev@activemq.apache.org we can better guide you. Let us know and welcome |
|
@rahul-chakradhari you can start by testing locally and identify flaky tests and fix it. |
Thread.sleep(3000) is unreliable on slow CI machines for waiting on cluster formation and client rebalancing. Replace all sleep-based synchronization with Wait.waitFor polling:
This also fixes AutoFailoverClusterTest which inherits these methods.