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

[servicecomb-java-chassis] branch master updated: [SCB-2739] fix flaky tests in clients (#3497)

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

liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git


The following commit(s) were added to refs/heads/master by this push:
     new 5de6563c4 [SCB-2739] fix flaky tests in clients (#3497)
5de6563c4 is described below

commit 5de6563c427ca039c5221cdfb76e0cee9917a71b
Author: anantdahiya8 <th...@gmail.com>
AuthorDate: Thu Nov 24 00:52:53 2022 -0500

    [SCB-2739] fix flaky tests in clients (#3497)
---
 .../service/center/client/ServiceCenterClientTest.java       | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java b/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java
index 0a2a96b52..12ad9cda3 100755
--- a/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java
+++ b/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java
@@ -36,6 +36,7 @@ import org.apache.servicecomb.service.center.client.model.SchemaInfo;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 import org.mockito.Mockito;
+import org.mockito.ArgumentMatchers;
 
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -116,7 +117,8 @@ public class ServiceCenterClientTest {
     objectMapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
 
     Mockito.when(serviceCenterRawClient
-        .postHttpRequest("/registry/microservices", null, objectMapper.writeValueAsString(microservice)))
+        .postHttpRequest(ArgumentMatchers.eq("/registry/microservices"), ArgumentMatchers.eq(null),
+        Mockito.anyString()))
         .thenReturn(httpResponse);
 
     ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient);
@@ -250,8 +252,9 @@ public class ServiceCenterClientTest {
     ObjectMapper mapper = new ObjectMapper();
     mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
 
-    Mockito.when(serviceCenterRawClient.postHttpRequest("/registry/microservices/222222/instances", null,
-        mapper.writeValueAsString(instance)))
+    Mockito.when(serviceCenterRawClient.postHttpRequest(ArgumentMatchers.eq("/registry/microservices/222222/instances"),
+        ArgumentMatchers.eq(null),
+        Mockito.anyString()))
         .thenReturn(httpResponse);
 
     ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient);
@@ -387,7 +390,8 @@ public class ServiceCenterClientTest {
         .when(serviceCenterRawClient.putHttpRequest("/registry/microservices/111/instances/222/heartbeat", null, null))
         .thenReturn(httpResponse);
     Mockito.when(serviceCenterRawClient
-        .putHttpRequest("/registry/heartbeats", null, mapper.writeValueAsString(heartbeatsRequest)))
+        .putHttpRequest(ArgumentMatchers.eq("/registry/heartbeats"), ArgumentMatchers.eq(null),
+        Mockito.anyString()))
         .thenReturn(httpResponse);
 
     ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient);