zonghaishang commented on a change in pull request #2591: FailbackRegistry
Test: recover method
URL: https://github.com/apache/incubator-dubbo/pull/2591#discussion_r221541892
##########
File path:
dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/FailbackRegistryTest.java
##########
@@ -180,6 +181,27 @@ public void notify(List<URL> urls) {
assertEquals(2, count.get());
}
+ @Test
+ public void testRecover() throws Exception {
+ CountDownLatch countDownLatch = new CountDownLatch(2);
+ final AtomicReference<Boolean> notified = new
AtomicReference<Boolean>(false);
+
+ NotifyListener listner = new NotifyListener() {
+ @Override
+ public void notify(List<URL> urls) {
+ notified.set(Boolean.TRUE);
+ }
+ };
+
+ MockRegistry mockRegistry = new MockRegistry(registryUrl,
countDownLatch);
+ mockRegistry.register(serviceUrl);
+ mockRegistry.subscribe(serviceUrl, listner);
+ Assert.assertEquals(mockRegistry.getRegistered().size(), 1);
+ Assert.assertEquals(mockRegistry.getSubscribed().size(), 1);
+ mockRegistry.recover();
+ Assert.assertEquals(mockRegistry.getFailedSubscribed().size(), 1);
+ Assert.assertEquals(countDownLatch.getCount(), 0);
Review comment:
The default is to retry every 5 seconds,relying on this value of `0` will
cause this test case to be unstable?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services