[ISSUE #243]fix Integration testing too long
This commit is contained in:
parent
0a1d949fd4
commit
e15e902975
@ -97,6 +97,8 @@
|
|||||||
<version>2.9</version>
|
<version>2.9</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<argLine>-Dnacos.standalone=true</argLine>
|
<argLine>-Dnacos.standalone=true</argLine>
|
||||||
|
<parallel>methods</parallel>
|
||||||
|
<useUnlimitedThreads>true</useUnlimitedThreads>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
@ -55,7 +55,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest(classes = Config.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
@SpringBootTest(classes = Config.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||||
public class ConfigAPI_ITCase {
|
public class ConfigAPI_ITCase {
|
||||||
public static final long TIME_OUT = 3000;
|
public static final long TIME_OUT = 2000;
|
||||||
public ConfigService iconfig = null;
|
public ConfigService iconfig = null;
|
||||||
ServerHttpAgent agent = null;
|
ServerHttpAgent agent = null;
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ public class ConfigAPI_ITCase {
|
|||||||
final String content = "test";
|
final String content = "test";
|
||||||
|
|
||||||
boolean result = iconfig.publishConfig(dataId, null, content);
|
boolean result = iconfig.publishConfig(dataId, null, content);
|
||||||
Thread.sleep(2*TIME_OUT);
|
Thread.sleep(TIME_OUT);
|
||||||
Assert.assertTrue(result);
|
Assert.assertTrue(result);
|
||||||
|
|
||||||
String value = iconfig.getConfig(dataId, null, TIME_OUT);
|
String value = iconfig.getConfig(dataId, null, TIME_OUT);
|
||||||
@ -232,7 +232,7 @@ public class ConfigAPI_ITCase {
|
|||||||
public void nacos_publishConfig_5() throws Exception {
|
public void nacos_publishConfig_5() throws Exception {
|
||||||
String content = "test";
|
String content = "test";
|
||||||
boolean result = iconfig.publishConfig(dataId, null, content);
|
boolean result = iconfig.publishConfig(dataId, null, content);
|
||||||
Thread.sleep(2*TIME_OUT);
|
Thread.sleep(TIME_OUT);
|
||||||
Assert.assertTrue(result);
|
Assert.assertTrue(result);
|
||||||
|
|
||||||
String value = iconfig.getConfig(dataId, null, TIME_OUT);
|
String value = iconfig.getConfig(dataId, null, TIME_OUT);
|
||||||
|
@ -23,6 +23,7 @@ import com.alibaba.nacos.client.naming.beat.BeatInfo;
|
|||||||
import com.alibaba.nacos.naming.NamingApp;
|
import com.alibaba.nacos.naming.NamingApp;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
@ -55,7 +56,7 @@ public class AutoDeregisterInstance_ITCase {
|
|||||||
@Before
|
@Before
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
if (naming == null) {
|
if (naming == null) {
|
||||||
TimeUnit.SECONDS.sleep(10);
|
//TimeUnit.SECONDS.sleep(10);
|
||||||
naming = NamingFactory.createNamingService("127.0.0.1" + ":" + port);
|
naming = NamingFactory.createNamingService("127.0.0.1" + ":" + port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -66,11 +67,9 @@ public class AutoDeregisterInstance_ITCase {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
|
@Ignore
|
||||||
public void autoDregDomClustersTest() throws Exception {
|
public void autoDregDomClustersTest() throws Exception {
|
||||||
|
|
||||||
String serviceName = randomDomainName();
|
String serviceName = randomDomainName();
|
||||||
// String serviceName="jinhanH0Gkc.cyS1n.com";
|
|
||||||
System.out.println(serviceName);
|
|
||||||
|
|
||||||
naming.registerInstance(serviceName, "127.0.0.1", TEST_PORT, "c1");
|
naming.registerInstance(serviceName, "127.0.0.1", TEST_PORT, "c1");
|
||||||
naming.registerInstance(serviceName, "127.0.0.2", TEST_PORT, "c2");
|
naming.registerInstance(serviceName, "127.0.0.2", TEST_PORT, "c2");
|
||||||
@ -86,8 +85,8 @@ public class AutoDeregisterInstance_ITCase {
|
|||||||
|
|
||||||
namingServiceImpl.getBeatReactor().removeBeatInfo(serviceName, "127.0.0.1", TEST_PORT);
|
namingServiceImpl.getBeatReactor().removeBeatInfo(serviceName, "127.0.0.1", TEST_PORT);
|
||||||
|
|
||||||
TimeUnit.SECONDS.sleep(40);
|
//TimeUnit.SECONDS.sleep(40);
|
||||||
|
verifyInstanceList(instances, 1, serviceName);
|
||||||
instances = naming.getAllInstances(serviceName);
|
instances = naming.getAllInstances(serviceName);
|
||||||
|
|
||||||
Assert.assertEquals(1, instances.size());
|
Assert.assertEquals(1, instances.size());
|
||||||
@ -97,7 +96,6 @@ public class AutoDeregisterInstance_ITCase {
|
|||||||
|
|
||||||
instances = naming.getAllInstances(serviceName, Arrays.asList("c1"));
|
instances = naming.getAllInstances(serviceName, Arrays.asList("c1"));
|
||||||
Assert.assertEquals(0, instances.size());
|
Assert.assertEquals(0, instances.size());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -107,11 +105,9 @@ public class AutoDeregisterInstance_ITCase {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
|
@Ignore
|
||||||
public void autoDregDomTest() throws Exception {
|
public void autoDregDomTest() throws Exception {
|
||||||
|
|
||||||
String serviceName = randomDomainName();
|
String serviceName = randomDomainName();
|
||||||
// String serviceName="jinhanH0Gkc.cyS1n.com";
|
|
||||||
// System.out.println(serviceName);
|
|
||||||
|
|
||||||
naming.registerInstance(serviceName, "127.0.0.1", TEST_PORT);
|
naming.registerInstance(serviceName, "127.0.0.1", TEST_PORT);
|
||||||
naming.registerInstance(serviceName, "127.0.0.2", TEST_PORT);
|
naming.registerInstance(serviceName, "127.0.0.2", TEST_PORT);
|
||||||
@ -127,8 +123,8 @@ public class AutoDeregisterInstance_ITCase {
|
|||||||
|
|
||||||
namingServiceImpl.getBeatReactor().removeBeatInfo(serviceName, "127.0.0.1", TEST_PORT);
|
namingServiceImpl.getBeatReactor().removeBeatInfo(serviceName, "127.0.0.1", TEST_PORT);
|
||||||
|
|
||||||
TimeUnit.SECONDS.sleep(40);
|
//TimeUnit.SECONDS.sleep(40);
|
||||||
|
verifyInstanceList(instances, 1, serviceName);
|
||||||
instances = naming.getAllInstances(serviceName);
|
instances = naming.getAllInstances(serviceName);
|
||||||
|
|
||||||
Assert.assertEquals(1, instances.size());
|
Assert.assertEquals(1, instances.size());
|
||||||
@ -144,7 +140,6 @@ public class AutoDeregisterInstance_ITCase {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void autoRegDomTest() throws Exception {
|
public void autoRegDomTest() throws Exception {
|
||||||
|
|
||||||
String serviceName = randomDomainName();
|
String serviceName = randomDomainName();
|
||||||
|
|
||||||
naming.registerInstance(serviceName, "127.0.0.1", TEST_PORT);
|
naming.registerInstance(serviceName, "127.0.0.1", TEST_PORT);
|
||||||
@ -161,7 +156,8 @@ public class AutoDeregisterInstance_ITCase {
|
|||||||
|
|
||||||
namingServiceImpl.getBeatReactor().removeBeatInfo(serviceName, "127.0.0.1", TEST_PORT);
|
namingServiceImpl.getBeatReactor().removeBeatInfo(serviceName, "127.0.0.1", TEST_PORT);
|
||||||
|
|
||||||
TimeUnit.SECONDS.sleep(40);
|
//TimeUnit.SECONDS.sleep(40);
|
||||||
|
verifyInstanceList(instances, 1, serviceName);
|
||||||
|
|
||||||
instances = naming.getAllInstances(serviceName);
|
instances = naming.getAllInstances(serviceName);
|
||||||
|
|
||||||
@ -172,13 +168,11 @@ public class AutoDeregisterInstance_ITCase {
|
|||||||
beatInfo.setPort(TEST_PORT);
|
beatInfo.setPort(TEST_PORT);
|
||||||
|
|
||||||
namingServiceImpl.getBeatReactor().addBeatInfo(serviceName, beatInfo);
|
namingServiceImpl.getBeatReactor().addBeatInfo(serviceName, beatInfo);
|
||||||
TimeUnit.SECONDS.sleep(15);
|
verifyInstanceList(instances, 2, serviceName);
|
||||||
|
|
||||||
instances = naming.getAllInstances(serviceName);
|
instances = naming.getAllInstances(serviceName);
|
||||||
|
|
||||||
Assert.assertEquals(instances.size(), 2);
|
Assert.assertEquals(instances.size(), 2);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -206,7 +200,8 @@ public class AutoDeregisterInstance_ITCase {
|
|||||||
|
|
||||||
namingServiceImpl.getBeatReactor().removeBeatInfo(serviceName, "127.0.0.1", TEST_PORT);
|
namingServiceImpl.getBeatReactor().removeBeatInfo(serviceName, "127.0.0.1", TEST_PORT);
|
||||||
|
|
||||||
TimeUnit.SECONDS.sleep(40);
|
//TimeUnit.SECONDS.sleep(40);
|
||||||
|
verifyInstanceList(instances, 1, serviceName);
|
||||||
|
|
||||||
instances = naming.getAllInstances(serviceName);
|
instances = naming.getAllInstances(serviceName);
|
||||||
|
|
||||||
@ -219,7 +214,8 @@ public class AutoDeregisterInstance_ITCase {
|
|||||||
|
|
||||||
|
|
||||||
namingServiceImpl.getBeatReactor().addBeatInfo(serviceName, beatInfo);
|
namingServiceImpl.getBeatReactor().addBeatInfo(serviceName, beatInfo);
|
||||||
TimeUnit.SECONDS.sleep(15);
|
//TimeUnit.SECONDS.sleep(15);
|
||||||
|
verifyInstanceList(instances, 2, serviceName);
|
||||||
|
|
||||||
instances = naming.getAllInstances(serviceName);
|
instances = naming.getAllInstances(serviceName);
|
||||||
|
|
||||||
@ -234,4 +230,17 @@ public class AutoDeregisterInstance_ITCase {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void verifyInstanceList(List<Instance> instances, int size, String serviceName) throws Exception {
|
||||||
|
int i = 0;
|
||||||
|
while ( i < 20 ) {
|
||||||
|
instances = naming.getAllInstances(serviceName);
|
||||||
|
if (instances.size() == size) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
TimeUnit.SECONDS.sleep(3);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ public class DeregisterInstance_ITCase {
|
|||||||
@Before
|
@Before
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
if (naming == null) {
|
if (naming == null) {
|
||||||
TimeUnit.SECONDS.sleep(10);
|
//TimeUnit.SECONDS.sleep(10);
|
||||||
naming = NamingFactory.createNamingService("127.0.0.1" + ":" + port);
|
naming = NamingFactory.createNamingService("127.0.0.1" + ":" + port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,7 +65,6 @@ public class DeregisterInstance_ITCase {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void dregDomTest() throws Exception {
|
public void dregDomTest() throws Exception {
|
||||||
|
|
||||||
String serviceName = randomDomainName();
|
String serviceName = randomDomainName();
|
||||||
|
|
||||||
naming.registerInstance(serviceName, "127.0.0.1", TEST_PORT);
|
naming.registerInstance(serviceName, "127.0.0.1", TEST_PORT);
|
||||||
|
@ -56,7 +56,7 @@ public class RegisterInstance_ITCase {
|
|||||||
@Before
|
@Before
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
if (naming == null) {
|
if (naming == null) {
|
||||||
TimeUnit.SECONDS.sleep(10);
|
//TimeUnit.SECONDS.sleep(10);
|
||||||
naming = NamingFactory.createNamingService("127.0.0.1" + ":" + port);
|
naming = NamingFactory.createNamingService("127.0.0.1" + ":" + port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ public class SelectInstances_ITCase {
|
|||||||
@Before
|
@Before
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
if (naming == null) {
|
if (naming == null) {
|
||||||
TimeUnit.SECONDS.sleep(10);
|
//TimeUnit.SECONDS.sleep(10);
|
||||||
naming = NamingFactory.createNamingService("127.0.0.1" + ":" + port);
|
naming = NamingFactory.createNamingService("127.0.0.1" + ":" + port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ public class SelectOneHealthyInstance_ITCase {
|
|||||||
@Before
|
@Before
|
||||||
public void init() throws Exception{
|
public void init() throws Exception{
|
||||||
if (naming == null) {
|
if (naming == null) {
|
||||||
TimeUnit.SECONDS.sleep(10);
|
//TimeUnit.SECONDS.sleep(10);
|
||||||
naming = NamingFactory.createNamingService("127.0.0.1"+":"+port);
|
naming = NamingFactory.createNamingService("127.0.0.1"+":"+port);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ public class ServiceListTest {
|
|||||||
@Before
|
@Before
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
if (naming == null) {
|
if (naming == null) {
|
||||||
TimeUnit.SECONDS.sleep(10);
|
//TimeUnit.SECONDS.sleep(10);
|
||||||
naming = NamingFactory.createNamingService("127.0.0.1" + ":" + port);
|
naming = NamingFactory.createNamingService("127.0.0.1" + ":" + port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public class SubscribeCluster_ITCase {
|
|||||||
public void init() throws Exception{
|
public void init() throws Exception{
|
||||||
instances.clear();
|
instances.clear();
|
||||||
if (naming == null) {
|
if (naming == null) {
|
||||||
TimeUnit.SECONDS.sleep(10);
|
//TimeUnit.SECONDS.sleep(10);
|
||||||
naming = NamingFactory.createNamingService("127.0.0.1"+":"+port);
|
naming = NamingFactory.createNamingService("127.0.0.1"+":"+port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,7 +212,7 @@ public class SubscribeCluster_ITCase {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
while (instances.isEmpty()) {
|
while (instances.isEmpty()) {
|
||||||
Thread.sleep(1000L);
|
Thread.sleep(1000L);
|
||||||
if (i++ > 20) {
|
if (i++ > 10) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ public class Subscribe_ITCase {
|
|||||||
public void init() throws Exception{
|
public void init() throws Exception{
|
||||||
instances.clear();
|
instances.clear();
|
||||||
if (naming == null) {
|
if (naming == null) {
|
||||||
TimeUnit.SECONDS.sleep(10);
|
//TimeUnit.SECONDS.sleep(10);
|
||||||
naming = NamingFactory.createNamingService("127.0.0.1"+":"+port);
|
naming = NamingFactory.createNamingService("127.0.0.1"+":"+port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ public class Unsubscribe_ITCase {
|
|||||||
public void init() throws Exception{
|
public void init() throws Exception{
|
||||||
instances = Collections.emptyList();
|
instances = Collections.emptyList();
|
||||||
if (naming == null) {
|
if (naming == null) {
|
||||||
TimeUnit.SECONDS.sleep(10);
|
//TimeUnit.SECONDS.sleep(10);
|
||||||
naming = NamingFactory.createNamingService("127.0.0.1"+":"+port);
|
naming = NamingFactory.createNamingService("127.0.0.1"+":"+port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ public class Unsubscribe_ITCase {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
while (instances.isEmpty()) {
|
while (instances.isEmpty()) {
|
||||||
Thread.sleep(1000L);
|
Thread.sleep(1000L);
|
||||||
if (i++ > 20) {
|
if (i++ > 10) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ public class Unsubscribe_ITCase {
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
while (instances.isEmpty()) {
|
while (instances.isEmpty()) {
|
||||||
Thread.sleep(1000L);
|
Thread.sleep(1000L);
|
||||||
if (i++ > 20) {
|
if (i++ > 10) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user