Skip to content

Commit 79c6166

Browse files
biyuhaoCrazyHZM
authored andcommitted
Stabilize EtcdMetadataReportTest (apache#5088)
1 parent 87631aa commit 79c6166

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

dubbo-metadata-report/dubbo-metadata-report-etcd/src/test/java/org/apache/dubbo/metadata/store/etcd/EtcdMetadataReportTest.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.junit.jupiter.api.AfterEach;
3333
import org.junit.jupiter.api.Assertions;
3434
import org.junit.jupiter.api.BeforeEach;
35-
import org.junit.jupiter.api.Disabled;
3635
import org.junit.jupiter.api.Test;
3736

3837
import java.net.URI;
@@ -44,6 +43,7 @@
4443

4544
import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER_SIDE;
4645
import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER_SIDE;
46+
import static org.apache.dubbo.metadata.support.Constants.SYNC_REPORT_KEY;
4747

4848
/**
4949
* Unit test for etcd metadata report
@@ -63,7 +63,7 @@ public void setUp() {
6363
etcdCluster.start();
6464
etcdClientForTest = Client.builder().endpoints(etcdCluster.getClientEndpoints()).build();
6565
List<URI> clientEndPoints = etcdCluster.getClientEndpoints();
66-
this.registryUrl = URL.valueOf("etcd://" + clientEndPoints.get(0).getHost() + ":" + clientEndPoints.get(0).getPort());
66+
this.registryUrl = URL.valueOf("etcd://" + clientEndPoints.get(0).getHost() + ":" + clientEndPoints.get(0).getPort()).addParameter(SYNC_REPORT_KEY, true);
6767
etcdMetadataReportFactory = new EtcdMetadataReportFactory();
6868
this.etcdMetadataReport = (EtcdMetadataReport) etcdMetadataReportFactory.createMetadataReport(registryUrl);
6969
}
@@ -74,7 +74,6 @@ public void tearDown() throws Exception {
7474
}
7575

7676
@Test
77-
@Disabled("Disabled because https://github.com/apache/dubbo/issues/4185")
7877
public void testStoreProvider() throws Exception {
7978
String version = "1.0.0";
8079
String group = null;
@@ -120,7 +119,6 @@ private MetadataIdentifier storeProvider(EtcdMetadataReport etcdMetadataReport,
120119
ServiceDefinitionBuilder.buildFullDefinition(interfaceClass, url.getParameters());
121120

122121
etcdMetadataReport.storeProviderMetadata(providerMetadataIdentifier, fullServiceDefinition);
123-
Thread.sleep(1000);
124122
return providerMetadataIdentifier;
125123
}
126124

@@ -131,7 +129,6 @@ private MetadataIdentifier storeConsumer(EtcdMetadataReport etcdMetadataReport,
131129
Map<String, String> tmp = new HashMap<>();
132130
tmp.put("paramConsumerTest", "etcdConsumer");
133131
etcdMetadataReport.storeConsumerMetadata(consumerIdentifier, tmp);
134-
Thread.sleep(1000);
135132
return consumerIdentifier;
136133
}
137134
}

0 commit comments

Comments
 (0)