diff --git a/test/src/test/java/com/alibaba/nacos/test/naming/MultipleTenantTest.java b/test/src/test/java/com/alibaba/nacos/test/naming/MultipleTenantTest.java index 4f91ec561..c7829f2ba 100644 --- a/test/src/test/java/com/alibaba/nacos/test/naming/MultipleTenantTest.java +++ b/test/src/test/java/com/alibaba/nacos/test/naming/MultipleTenantTest.java @@ -24,14 +24,15 @@ import static com.alibaba.nacos.test.naming.NamingBase.*; /** * @author nkorange */ -//@RunWith(SpringRunner.class) -//@SpringBootTest(classes = NamingApp.class, properties = {"server.servlet.context-path=/nacos"}, -// webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@RunWith(SpringRunner.class) +@SpringBootTest(classes = NamingApp.class, properties = {"server.servlet.context-path=/nacos"}, + webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) public class MultipleTenantTest { private NamingService naming; private NamingService naming1; private NamingService naming2; + @LocalServerPort private int port; @@ -42,8 +43,6 @@ public class MultipleTenantTest { TimeUnit.SECONDS.sleep(10); - port = 8848; - naming = NamingFactory.createNamingService("127.0.0.1" + ":" + port); Properties properties = new Properties(); @@ -88,8 +87,6 @@ public class MultipleTenantTest { instances = naming.getAllInstances(serviceName); Assert.assertEquals(2, instances.size()); - - TimeUnit.SECONDS.sleep(10000000L); } @Test