dlmarion commented on code in PR #5056:
URL: https://github.com/apache/accumulo/pull/5056#discussion_r1841131302


##########
test/src/main/java/org/apache/accumulo/test/InstanceOperationsIT.java:
##########
@@ -44,12 +44,66 @@
 
 public class InstanceOperationsIT extends AccumuloClusterHarness {
 
+  final int NUM_COMPACTORS = 3;
+  final int NUM_SCANSERVERS = 2;
+  final int NUM_TABLETSERVERS = 1;
+
   @Override
   public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration 
hadoopCoreSite) {
     cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "10s");
-    cfg.getClusterServerConfiguration().setNumDefaultCompactors(3);
-    cfg.getClusterServerConfiguration().setNumDefaultScanServers(2);
-    cfg.getClusterServerConfiguration().setNumDefaultTabletServers(1);
+    
cfg.getClusterServerConfiguration().setNumDefaultCompactors(NUM_COMPACTORS);
+    
cfg.getClusterServerConfiguration().setNumDefaultScanServers(NUM_SCANSERVERS);
+    
cfg.getClusterServerConfiguration().setNumDefaultTabletServers(NUM_TABLETSERVERS);
+  }
+
+  /**
+   * Verify that we get the same servers from getServers() and getServer()
+   */
+  @Test
+  public void testGetServer() {
+    try (AccumuloClient client = 
Accumulo.newClient().from(getClientProps()).build()) {
+      final InstanceOperations iops = client.instanceOperations();
+
+      // Verify scan servers
+      final Set<ServerId> sservers = 
iops.getServers(ServerId.Type.SCAN_SERVER);
+      assertEquals(NUM_SCANSERVERS, sservers.size());
+      sservers.forEach(serverId -> {
+        ServerId server = iops.getServer(serverId.getType(), 
serverId.getResourceGroup(),
+            serverId.getHost(), serverId.getPort());
+        assertNotNull(server, "Expected to find scan server " + serverId);
+        assertEquals(ServerId.Type.SCAN_SERVER, server.getType());

Review Comment:
   instead of just checking the type, can you `assertEquals(serverId, server);`?



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