add testcase

This commit is contained in:
mingyixu 2019-07-05 14:21:46 +08:00
parent d2f26bd4e4
commit 2988dabffd
4 changed files with 9 additions and 5 deletions

View File

@ -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() {

View File

@ -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<Instance> instances, int size, String serviceName) throws Exception {

View File

@ -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");

View File

@ -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();