Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix flaky DiscoveryServiceTest (apache#9258)
Fix this flaky test DiscoveryServiceTest The test may result flaky on slow machines because the update of the cache happens asynchronously. Change: - wait for the cache to be updated before performing the assertions - add more information during the failure - add awaitility test dependency to the pulsar-discovery-service module This is the error, quite frequent on GitHub Actions ``` java.lang.AssertionError: did not expect [pulsar://broker-:150000] but found [pulsar://broker-:150000] at org.testng.Assert.fail(Assert.java:99) at org.testng.Assert.failEquals(Assert.java:1041) at org.testng.Assert.assertNotEqualsImpl(Assert.java:147) at org.testng.Assert.assertNotEquals(Assert.java:1531) at org.testng.Assert.assertNotEquals(Assert.java:1535) at org.apache.pulsar.discovery.service.DiscoveryServiceTest.testBrokerDiscoveryRoundRobin(DiscoveryServiceTest.java:95) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132) at org.testng.internal.InvokeMethodRunnable.runOne(InvokeMethodRunnable.java:45) at org.testng.internal.InvokeMethodRunnable.call(InvokeMethodRunnable.java:73) at org.testng.internal.InvokeMethodRunnable.call(InvokeMethodRunnable.java:11) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) ```
- Loading branch information