Skip to content

Commit

Permalink
fix unit test unstable problem (#1355)
Browse files Browse the repository at this point in the history
Co-authored-by: liujianjun.ljj <[email protected]>
  • Loading branch information
EvenLjj and liujianjun.ljj authored Jul 28, 2023
1 parent a0ea9ed commit 8ca4f28
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void testApplicationInfo() {
public void before() {

httpMockServer = new HttpMockServer();
meshApiClient = new MeshApiClient("http://localhost:7654");
meshApiClient = new MeshApiClient("http://127.0.0.1:7654");

httpMockServer.initSever(7654);
ApplicationInfoResult applicationInfoResult = new ApplicationInfoResult();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void setUp() {
.setProtocol("mesh")
.setSubscribe(true)
.setRegister(true)
.setAddress("http://localhost:7654");
.setAddress("http://127.0.0.1:7654");

registry = (MeshRegistry) RegistryFactory.getRegistry(registryConfig);
registry.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void doTest() throws Exception {
referenceBeanC.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanC.setInterfaceId(SampleService.class.getName());
referenceBeanC.setUniqueId("C5");
referenceBeanC.setDirectUrl("localhost:12299");
referenceBeanC.setDirectUrl("127.0.0.1:12299");
referenceBeanC.setTimeout(1000);
MethodConfig methodConfigC = new MethodConfig()
.setName("hello")
Expand All @@ -84,7 +84,7 @@ public void doTest() throws Exception {
referenceBeanD.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanD.setInterfaceId(SampleService.class.getName());
referenceBeanD.setUniqueId("D5");
referenceBeanD.setDirectUrl("localhost:12299?p=1&v=4.0");
referenceBeanD.setDirectUrl("127.0.0.1:12299?p=1&v=4.0");
referenceBeanD.setTimeout(1000);
SampleService sampleServiceD = (SampleService) referenceBeanD.refer();

Expand All @@ -107,7 +107,7 @@ public void doTest() throws Exception {
referenceBeanA.setApplication(new ApplicationConfig().setAppName("AAA"));
referenceBeanA.setUniqueId("B5");
referenceBeanA.setInterfaceId(SampleService.class.getName());
referenceBeanA.setDirectUrl("localhost:12299");
referenceBeanA.setDirectUrl("127.0.0.1:12299");
referenceBeanA.setTimeout(3000);
MethodConfig methodConfigA = new MethodConfig()
.setName("hello")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void doTest() throws Exception {
referenceBeanC.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanC.setInterfaceId(SampleService.class.getName());
referenceBeanC.setUniqueId("C3");
referenceBeanC.setDirectUrl("localhost:12299");
referenceBeanC.setDirectUrl("127.0.0.1:12299");
referenceBeanC.setTimeout(1000);
MethodConfig methodConfigC = new MethodConfig()
.setName("hello")
Expand All @@ -85,7 +85,7 @@ public void doTest() throws Exception {
referenceBeanD.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanD.setInterfaceId(SampleService.class.getName());
referenceBeanD.setUniqueId("D3");
referenceBeanD.setDirectUrl("localhost:12299?p=1&v=4.0");
referenceBeanD.setDirectUrl("127.0.0.1:12299?p=1&v=4.0");
referenceBeanD.setTimeout(1000);
MethodConfig methodConfigD = new MethodConfig()
.setName("hello")
Expand All @@ -112,7 +112,7 @@ public void doTest() throws Exception {
referenceBeanA.setApplication(new ApplicationConfig().setAppName("AAA"));
referenceBeanA.setUniqueId("B3");
referenceBeanA.setInterfaceId(SampleService.class.getName());
referenceBeanA.setDirectUrl("localhost:12299");
referenceBeanA.setDirectUrl("127.0.0.1:12299");
referenceBeanA.setTimeout(3000);
MethodConfig methodConfigA = new MethodConfig()
.setName("hello")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void doTest() throws Exception {
referenceBeanC.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanC.setInterfaceId(SampleService.class.getName());
referenceBeanC.setUniqueId("C2");
referenceBeanC.setDirectUrl("localhost:12299");
referenceBeanC.setDirectUrl("127.0.0.1:12299");
referenceBeanC.setTimeout(1000);
MethodConfig methodConfigC = new MethodConfig()
.setName("hello")
Expand All @@ -79,7 +79,7 @@ public void doTest() throws Exception {
referenceBeanD.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanD.setInterfaceId(SampleService.class.getName());
referenceBeanD.setUniqueId("D2");
referenceBeanD.setDirectUrl("localhost:12299?p=1&v=4.0");
referenceBeanD.setDirectUrl("127.0.0.1:12299?p=1&v=4.0");
referenceBeanD.setTimeout(1000);
MethodConfig methodConfigD = new MethodConfig()
.setName("hello")
Expand All @@ -103,7 +103,7 @@ public void doTest() throws Exception {
referenceBeanA.setApplication(new ApplicationConfig().setAppName("AAA"));
referenceBeanA.setUniqueId("B2");
referenceBeanA.setInterfaceId(SampleService.class.getName());
referenceBeanA.setDirectUrl("localhost:12299");
referenceBeanA.setDirectUrl("127.0.0.1:12299");
referenceBeanA.setTimeout(3000);
MethodConfig methodConfigA = new MethodConfig()
.setName("hello")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void doTest() {
referenceBeanC.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanC.setInterfaceId(SampleService.class.getName());
referenceBeanC.setUniqueId("C4");
referenceBeanC.setDirectUrl("localhost:12299");
referenceBeanC.setDirectUrl("127.0.0.1:12299");
referenceBeanC.setTimeout(1000);
SampleService sampleServiceC = (SampleService) referenceBeanC.refer();

Expand All @@ -74,7 +74,7 @@ void doTest() {
referenceBeanD.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanD.setInterfaceId(SampleService.class.getName());
referenceBeanD.setUniqueId("D4");
referenceBeanD.setDirectUrl("localhost:12299?p=1&v=4.0");
referenceBeanD.setDirectUrl("127.0.0.1:12299?p=1&v=4.0");
referenceBeanD.setTimeout(1000);
SampleService sampleServiceD = (SampleService) referenceBeanD.refer();

Expand All @@ -94,7 +94,7 @@ void doTest() {
referenceBeanA.setApplication(new ApplicationConfig().setAppName("AAA"));
referenceBeanA.setUniqueId("B4");
referenceBeanA.setInterfaceId(SampleService.class.getName());
referenceBeanA.setDirectUrl("localhost:12299");
referenceBeanA.setDirectUrl("127.0.0.1:12299");
referenceBeanA.setTimeout(3000);
MethodConfig methodConfigA = new MethodConfig()
.setName("hello")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void doTest() {
referenceBeanC.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanC.setInterfaceId(SampleService.class.getName());
referenceBeanC.setUniqueId("C1");
referenceBeanC.setDirectUrl("localhost:12299");
referenceBeanC.setDirectUrl("127.0.0.1:12299");
referenceBeanC.setTimeout(1000);
SampleService sampleServiceC = (SampleService) referenceBeanC.refer();

Expand All @@ -71,7 +71,7 @@ void doTest() {
referenceBeanD.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanD.setInterfaceId(SampleService.class.getName());
referenceBeanD.setUniqueId("D1");
referenceBeanD.setDirectUrl("localhost:12299?p=1&v=4.0");
referenceBeanD.setDirectUrl("127.0.0.1:12299?p=1&v=4.0");
referenceBeanD.setTimeout(1000);
SampleService sampleServiceD = (SampleService) referenceBeanD.refer();

Expand All @@ -91,7 +91,7 @@ void doTest() {
referenceBeanA.setApplication(new ApplicationConfig().setAppName("AAA"));
referenceBeanA.setUniqueId("B1");
referenceBeanA.setInterfaceId(SampleService.class.getName());
referenceBeanA.setDirectUrl("localhost:12299");
referenceBeanA.setDirectUrl("127.0.0.1:12299");
referenceBeanA.setTimeout(3000);

SampleService service = (SampleService) referenceBeanA.refer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void doTest() {
referenceBeanC.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanC.setInterfaceId(SampleService.class.getName());
referenceBeanC.setUniqueId("C1");
referenceBeanC.setDirectUrl("localhost:12299");
referenceBeanC.setDirectUrl("127.0.0.1:12299");
referenceBeanC.setSerialization("protobuf");
referenceBeanC.setTimeout(1000);
SampleService sampleServiceC = (SampleService) referenceBeanC.refer();
Expand All @@ -75,7 +75,7 @@ void doTest() {
referenceBeanD.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanD.setInterfaceId(SampleService.class.getName());
referenceBeanD.setUniqueId("D1");
referenceBeanD.setDirectUrl("localhost:12299?p=1&v=4.0");
referenceBeanD.setDirectUrl("127.0.0.1:12299?p=1&v=4.0");
referenceBeanD.setSerialization("protobuf");
referenceBeanD.setTimeout(1000);
SampleService sampleServiceD = (SampleService) referenceBeanD.refer();
Expand All @@ -96,7 +96,7 @@ void doTest() {
referenceBeanA.setApplication(new ApplicationConfig().setAppName("AAA"));
referenceBeanA.setUniqueId("B1");
referenceBeanA.setInterfaceId(SampleService.class.getName());
referenceBeanA.setDirectUrl("localhost:12299");
referenceBeanA.setDirectUrl("127.0.0.1:12299");
referenceBeanA.setSerialization("protobuf");
referenceBeanA.setTimeout(3000);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void testInvoke() throws InterruptedException {
ConsumerConfig<TripleHessianInterface> consumerConfig = new ConsumerConfig<TripleHessianInterface>();
consumerConfig.setInterfaceId(TripleHessianInterface.class.getName())
.setProtocol(RpcConstants.PROTOCOL_TYPE_TRIPLE)
.setDirectUrl("localhost:" + port)
.setDirectUrl("127.0.0.1:" + port)
.setRegister(false)
.setApplication(clientApp);

Expand Down Expand Up @@ -152,7 +152,7 @@ public void testInvokeWithUniqueId() throws InterruptedException {
ConsumerConfig<TripleHessianInterface> consumerConfig = new ConsumerConfig<TripleHessianInterface>();
consumerConfig.setInterfaceId(TripleHessianInterface.class.getName())
.setProtocol(RpcConstants.PROTOCOL_TYPE_TRIPLE)
.setDirectUrl("localhost:" + port)
.setDirectUrl("127.0.0.1:" + port)
.setUniqueId(uniqueId)
.setRegister(false)
.setApplication(clientApp);
Expand Down Expand Up @@ -183,7 +183,7 @@ public void testInvokeWithUniqueId() throws InterruptedException {
consumerConfig = new ConsumerConfig<TripleHessianInterface>();
consumerConfig.setInterfaceId(TripleHessianInterface.class.getName())
.setProtocol(RpcConstants.PROTOCOL_TYPE_TRIPLE)
.setDirectUrl("localhost:" + port)
.setDirectUrl("127.0.0.1:" + port)
.setRegister(false)
.setApplication(clientApp);

Expand Down Expand Up @@ -313,7 +313,7 @@ public void testExposeTwoUniqueId() {
ConsumerConfig<TripleHessianInterface> consumerConfig = new ConsumerConfig<>();
consumerConfig.setInterfaceId(TripleHessianInterface.class.getName())
.setProtocol(RpcConstants.PROTOCOL_TYPE_TRIPLE)
.setDirectUrl("localhost:" + port)
.setDirectUrl("127.0.0.1:" + port)
.setUniqueId(uniqueId)
.setRegister(false)
.setApplication(clientApp);
Expand All @@ -324,7 +324,7 @@ public void testExposeTwoUniqueId() {
ConsumerConfig<TripleHessianInterface> consumerConfig2 = new ConsumerConfig<>();
consumerConfig2.setInterfaceId(TripleHessianInterface.class.getName())
.setProtocol(RpcConstants.PROTOCOL_TYPE_TRIPLE)
.setDirectUrl("localhost:" + port)
.setDirectUrl("127.0.0.1:" + port)
.setUniqueId(uniqueId2)
.setRegister(false)
.setApplication(clientApp);
Expand Down Expand Up @@ -362,7 +362,7 @@ public void testTripleRpcInvokeContext() {
ConsumerConfig<TripleHessianInterface> consumerConfig = new ConsumerConfig<TripleHessianInterface>();
consumerConfig.setInterfaceId(TripleHessianInterface.class.getName())
.setProtocol(RpcConstants.PROTOCOL_TYPE_TRIPLE)
.setDirectUrl("localhost:" + port)
.setDirectUrl("127.0.0.1:" + port)
.setTimeout(300000)
.setRegister(false)
.setApplication(clientApp);
Expand Down

0 comments on commit 8ca4f28

Please sign in to comment.