Fix flaky DurableSubInBrokerNetworkTest by replacing fixed sleeps with Wait.waitFor polling#1906
Conversation
…nBrokerNetworkTest
There was a problem hiding this comment.
Thanks for the test fix! The only suggestion I have after a quick look is I think it would be better to speed up the polling time. The default calls to Wait.waitFor() wait up to 30 seconds and retry every second. I think it would be better to speed up the checks quicker and reduce the 30 second time so we timeout faster if it will fail. The default of 1 second is something I've considered changing as a default to be faster anyways as we often override it. Example:
// retries every 100 millis and times out after 15 seconds
assertTrue("Network bridge did not establish in time",
Wait.waitFor(() -> !nc.activeBridges().isEmpty(), 15000, 100));It probably makes sense to apply that to all the Wait.waitFor() calls
|
Thanks for the suggestion! I’ve updated the |
|
Should be good if CI passes tests |
|
Tests keep failing (probably another flaky test) but going to try one more time anyways |
|
CI is failing on MQTT, so not on the DurableSubInBrokerNetworkTest. |
Description:
DurableSubInBrokerNetworkTest was intermittently failing in CI due to timing issues.
setUp()started theDiscoveryNetworkConnectorand immediately let tests run, with no guarantee the bridge was established.After creating/removing durable subscriptions, the tests slept 100ms and then checked state with a single synchronous query. On slow or loaded CI machines, 100ms is insufficient for subscription changes to propagate across the broker network.
Error:
ref: https://github.com/apache/activemq/actions/runs/24242348177/job/70780252784