You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/23 02:58:54 UTC

[GitHub] [dubbo] plusmancn commented on a change in pull request #8844: Optimize some UnitTest case cost time sharply

plusmancn commented on a change in pull request #8844:
URL: https://github.com/apache/dubbo/pull/8844#discussion_r714439987



##########
File path: dubbo-remoting/dubbo-remoting-zookeeper-curator5/src/test/java/org/apache/dubbo/remoting/zookeeper/curator5/Curator5ZookeeperClientTest.java
##########
@@ -95,20 +97,11 @@ public void process(WatchedEvent watchedEvent) throws Exception {
     @Test
     public void testWithInvalidServer() {
         Assertions.assertThrows(IllegalStateException.class, () -> {
-            curatorClient = new Curator5ZookeeperClient(URL.valueOf("zookeeper://127.0.0.1:1/service"));
+            curatorClient = new Curator5ZookeeperClient(URL.valueOf("zookeeper://127.0.0.1:1/service?timeout=500"));

Review comment:
       单测里的的 zk 是本地连接,所以 500ms 是个安全超时时间,假如不放心的话,可以增加到 1000ms
   
   此外,假如没有超时时间,或者 zk 本身极慢,那么及时失败,会是更好的选择,因为继续跑下去大概率也是挂的,就没必要继续浪费等待时间了。
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org