diff --git a/test/src/test/java/com/alibaba/nacos/test/config/ConfigAPI_ITCase.java b/test/src/test/java/com/alibaba/nacos/test/config/ConfigAPI_ITCase.java index 90f1b9d43..364e02a6f 100644 --- a/test/src/test/java/com/alibaba/nacos/test/config/ConfigAPI_ITCase.java +++ b/test/src/test/java/com/alibaba/nacos/test/config/ConfigAPI_ITCase.java @@ -385,6 +385,7 @@ public class ConfigAPI_ITCase { final AtomicInteger count = new AtomicInteger(0); final String content = "test-abc"; boolean result = iconfig.publishConfig(dataId, group, content); + Thread.sleep(TIME_OUT); Assert.assertTrue(result); Listener ml = new AbstractListener() { diff --git a/test/src/test/java/com/alibaba/nacos/test/naming/DeregisterInstance_ITCase.java b/test/src/test/java/com/alibaba/nacos/test/naming/DeregisterInstance_ITCase.java index e88729082..5faddbb9b 100644 --- a/test/src/test/java/com/alibaba/nacos/test/naming/DeregisterInstance_ITCase.java +++ b/test/src/test/java/com/alibaba/nacos/test/naming/DeregisterInstance_ITCase.java @@ -159,7 +159,7 @@ public class DeregisterInstance_ITCase { verifyInstanceList(instances, 2, serviceName); instances = naming.getAllInstances(serviceName); - Assert.assertEquals(instances.size(), 2); + Assert.assertEquals(2, instances.size()); naming.deregisterInstance(serviceName, "127.0.0.1", TEST_PORT, "c1"); @@ -167,15 +167,15 @@ public class DeregisterInstance_ITCase { instances = naming.getAllInstances(serviceName); - Assert.assertEquals(instances.size(), 1); + Assert.assertEquals(1, instances.size()); instances = naming.getAllInstances(serviceName, Arrays.asList("c2")); - Assert.assertEquals(instances.size(), 1); + Assert.assertEquals(1, instances.size()); naming.deregisterInstance(serviceName,"127.0.0.2", TEST_PORT, "c2"); TimeUnit.SECONDS.sleep(5); instances = naming.getAllInstances(serviceName); - Assert.assertEquals(instances.size(), 0); + Assert.assertEquals(0, instances.size()); } public void verifyInstanceList(List instances, int size, String serviceName) throws Exception { diff --git a/test/src/test/java/com/alibaba/nacos/test/naming/NamingBase.java b/test/src/test/java/com/alibaba/nacos/test/naming/NamingBase.java index b87282fe5..a76fc785a 100644 --- a/test/src/test/java/com/alibaba/nacos/test/naming/NamingBase.java +++ b/test/src/test/java/com/alibaba/nacos/test/naming/NamingBase.java @@ -56,6 +56,8 @@ public class NamingBase { public static final int TEST_PORT = 8080; + public static final int TIME_OUT = 3000; + public static String randomDomainName() { StringBuilder sb = new StringBuilder(); sb.append("jinhan"); diff --git a/test/src/test/java/com/alibaba/nacos/test/naming/Subscribe_ITCase.java b/test/src/test/java/com/alibaba/nacos/test/naming/Subscribe_ITCase.java index b08fb9117..c1fe26ccb 100644 --- a/test/src/test/java/com/alibaba/nacos/test/naming/Subscribe_ITCase.java +++ b/test/src/test/java/com/alibaba/nacos/test/naming/Subscribe_ITCase.java @@ -28,6 +28,7 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.omg.CORBA.TIMEOUT; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.http.HttpEntity; @@ -169,7 +170,7 @@ public class Subscribe_ITCase extends RestAPI_ITCase { Assert.assertTrue(verifyInstanceList(instances, naming.getAllInstances(serviceName))); } - @Test + @Test(timeout = 20*TIME_OUT) public void subscribeEmpty() throws Exception { String serviceName = randomDomainName();