Arugal commented on issue #3051: Fix isSelf address. URL: https://github.com/apache/skywalking/pull/3051#issuecomment-510527091 Hi All Should a base class be abstracted to cover the necessary test. Taking ```ClusterRegister#registerRemote``` as an example, various plugins have different implementations. ps: I don't know if I described it clearly case 1: ```NacosCoordinatorTest``` ``` @Test public void queryRemoteNodes() throws NacosException { registerSelfRemote(); List<Instance> instances = mockInstance(); when(namingService.selectInstances(anyString(), anyBoolean())).thenReturn(instances); List<RemoteInstance> remoteInstances = coordinator.queryRemoteNodes(); assertEquals(2, remoteInstances.size()); RemoteInstance selfInstance = remoteInstances.get(0); validate(selfRemoteAddress, selfInstance); RemoteInstance notSelfInstance = remoteInstances.get(1); validate(remoteAddress, notSelfInstance); } ``` case 2: ```ZookeeperCoordinatorTest``` ``` @Test public void queryRemoteNodes() { } ``` case 3: ```EtcdCoordinatorTest``` ``` @Test public void queryRemoteNodes() { registerSelfRemote(); EtcdKeysResponse.EtcdNode node = PowerMockito.mock(EtcdKeysResponse.EtcdNode.class); EtcdKeysResponse.EtcdNode node1 = PowerMockito.mock(EtcdKeysResponse.EtcdNode.class); when(response.getNode()).thenReturn(node); list = new ArrayList<>(); List list1 = Mockito.spy(list); list1.add(node1); when(node.getNodes()).thenReturn(list1); when(node1.getValue()).thenReturn("{\"serviceId\":\"my-service\",\"host\":\"10.0.0.2\",\"port\":1001}"); List<RemoteInstance> remoteInstances = coordinator.queryRemoteNodes(); assertEquals(1, remoteInstances.size()); RemoteInstance selfInstance = remoteInstances.get(0); velidate(selfRemoteAddress, selfInstance); } ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
