From 9a0978a72ab25c6ba59d97f04fe8ba9e3e32ec6f Mon Sep 17 00:00:00 2001 From: "xiaochun.xxc" Date: Wed, 13 Mar 2019 11:16:41 +0800 Subject: [PATCH] delete intance before removeBeat in AP mode --- .../naming/MultiTenant_InstanceAPI_ITCase.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/test/src/test/java/com/alibaba/nacos/test/naming/MultiTenant_InstanceAPI_ITCase.java b/test/src/test/java/com/alibaba/nacos/test/naming/MultiTenant_InstanceAPI_ITCase.java index a410bb13b..58f62ea85 100644 --- a/test/src/test/java/com/alibaba/nacos/test/naming/MultiTenant_InstanceAPI_ITCase.java +++ b/test/src/test/java/com/alibaba/nacos/test/naming/MultiTenant_InstanceAPI_ITCase.java @@ -10,6 +10,7 @@ import java.util.concurrent.TimeUnit; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.alibaba.nacos.api.PropertyKeyConst; +import com.alibaba.nacos.api.common.Constants; import com.alibaba.nacos.api.naming.NamingFactory; import com.alibaba.nacos.api.naming.NamingService; import com.alibaba.nacos.api.naming.listener.Event; @@ -17,6 +18,7 @@ import com.alibaba.nacos.api.naming.listener.EventListener; import com.alibaba.nacos.api.naming.listener.NamingEvent; import com.alibaba.nacos.api.naming.pojo.Instance; import com.alibaba.nacos.api.naming.pojo.ListView; +import com.alibaba.nacos.client.naming.NacosNamingService; import com.alibaba.nacos.naming.NamingApp; import org.junit.Assert; @@ -273,8 +275,12 @@ public class MultiTenant_InstanceAPI_ITCase { naming.registerInstance(serviceName, "33.33.33.33", 8888); naming.registerInstance(serviceName, "44.44.44.44", 8888); - TimeUnit.SECONDS.sleep(5L); - + TimeUnit.SECONDS.sleep(3L); + //AP下,通过HTTP删除实例前必须删除心跳 + NacosNamingService namingServiceImpl = (NacosNamingService) naming2; + namingServiceImpl.getBeatReactor(). + removeBeatInfo(Constants.DEFAULT_GROUP + Constants.SERVICE_INFO_SPLITER + serviceName, "33.33.33.33", 8888); + TimeUnit.SECONDS.sleep(3L); ResponseEntity response = request("/nacos/v1/ns/instance", Params.newParams() .appendParam("serviceName", serviceName) @@ -311,6 +317,11 @@ public class MultiTenant_InstanceAPI_ITCase { TimeUnit.SECONDS.sleep(5L); + //AP下,通过HTTP删除实例前必须删除心跳 + NacosNamingService namingServiceImpl = (NacosNamingService) naming2; + namingServiceImpl.getBeatReactor(). + removeBeatInfo(TEST_GROUP_2 + Constants.SERVICE_INFO_SPLITER + serviceName, "22.22.22.22", 80); + ResponseEntity response = request("/nacos/v1/ns/instance", Params.newParams() .appendParam("serviceName", serviceName)