You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2019/11/18 05:56:52 UTC

[dubbo] branch master updated: fix unstable UT `AbstractMetadataReportFactoryTest` under multiple network adapters (#5303)

This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new c42b0a8  fix unstable UT `AbstractMetadataReportFactoryTest` under multiple network adapters (#5303)
c42b0a8 is described below

commit c42b0a8cb23be43e159a9f6256eb889e026d54f5
Author: Jason Joo <hb...@163.com>
AuthorDate: Mon Nov 18 13:56:12 2019 +0800

    fix unstable UT `AbstractMetadataReportFactoryTest` under multiple network adapters (#5303)
    
    fixes #5304
---
 .../metadata/report/support/AbstractMetadataReportFactoryTest.java  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportFactoryTest.java b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportFactoryTest.java
index e96f4cd..30d4ad1 100644
--- a/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportFactoryTest.java
+++ b/dubbo-metadata/dubbo-metadata-api/src/test/java/org/apache/dubbo/metadata/report/support/AbstractMetadataReportFactoryTest.java
@@ -101,8 +101,10 @@ public class AbstractMetadataReportFactoryTest {
 
     @Test
     public void testGetOneMetadataReportForIpFormat() {
-        URL url1 = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostName() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic");
-        URL url2 = URL.valueOf("zookeeper://" + NetUtils.getLocalAddress().getHostAddress() + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic");
+        String hostName = NetUtils.getLocalAddress().getHostName();
+        String ip = NetUtils.getIpByHost(hostName);
+        URL url1 = URL.valueOf("zookeeper://" + hostName + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic");
+        URL url2 = URL.valueOf("zookeeper://" + ip + ":4444/org.apache.dubbo.TestService?version=1.0.0&application=vic");
         MetadataReport metadataReport1 = metadataReportFactory.getMetadataReport(url1);
         MetadataReport metadataReport2 = metadataReportFactory.getMetadataReport(url2);
         Assertions.assertEquals(metadataReport1, metadataReport2);