Copilot commented on code in PR #7327:
URL: https://github.com/apache/ignite-3/pull/7327#discussion_r2651064131


##########
modules/client/src/test/java/org/apache/ignite/client/TestServer.java:
##########
@@ -217,14 +221,16 @@ public TestServer(
         }
 
         this.nodeName = nodeName;
+        this.nodeId = nodeId == null ? getNodeId(nodeName) : nodeId;
+
         this.ignite = ignite;
 
         ClusterService clusterService = mock(ClusterService.class, 
RETURNS_DEEP_STUBS);
-        
Mockito.when(clusterService.topologyService().localMember().id()).thenReturn(getNodeId(nodeName));
+        
Mockito.when(clusterService.topologyService().localMember().id()).thenReturn(this.nodeId);
         
Mockito.when(clusterService.topologyService().localMember().name()).thenReturn(nodeName);
-        
Mockito.when(clusterService.topologyService().localMember()).thenReturn(getClusterNode(nodeName));
+        
Mockito.when(clusterService.topologyService().localMember()).thenReturn(getClusterNode(nodeName,
 this.nodeId));
         
Mockito.when(clusterService.topologyService().getByConsistentId(anyString())).thenAnswer(
-                i -> getClusterNode(i.getArgument(0, String.class)));
+                i -> getClusterNode(i.getArgument(0, String.class), 
getNodeId(i.getArgument(0, String.class))));

Review Comment:
   The mock for `getByConsistentId` is inconsistent with the local member's 
node ID when a custom nodeId is provided. When a TestServer is created with a 
random nodeId, `localMember().id()` returns that random UUID, but 
`getByConsistentId(nodeName)` returns a ClusterNode with a different UUID 
derived from the node name. Consider updating this to handle the case where the 
queried consistent ID matches `this.nodeName`, returning `this.nodeId` instead 
of `getNodeId()`.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to