mcvsubbu commented on a change in pull request #3633: Use 
ZkCacheBaseDataAccessor to cache instance configs in PinotHelixResourceManager
URL: https://github.com/apache/incubator-pinot/pull/3633#discussion_r245350804
 
 

 ##########
 File path: 
pinot-controller/src/test/java/com/linkedin/pinot/controller/helix/core/PinotHelixResourceManagerTest.java
 ##########
 @@ -76,6 +83,31 @@ public void testGetInstanceEndpoints() throws 
InvalidConfigException {
     for (int i = 0; i < NUM_INSTANCES; i++) {
       Assert.assertTrue(endpoints.inverse().containsKey("localhost:" + 
String.valueOf(BASE_SERVER_ADMIN_PORT + i)));
     }
+    ZkCacheBaseDataAccessor<ZNRecord> zkCacheBaseDataAccessor = 
_helixResourceManager.getCacheInstanceConfigsDataAccessor();
+    Assert.assertNotNull(zkCacheBaseDataAccessor);
+    List<ZNRecord> znRecords = zkCacheBaseDataAccessor.getChildren("/", null, 
AccessOption.PERSISTENT);
+    for (ZNRecord znRecord : znRecords) {
+      if (znRecord.getId().startsWith("Server")) {
+        
Assert.assertNotNull(znRecord.getSimpleField(CommonConstants.Helix.Instance.ADMIN_PORT_KEY));
+        String adminPort = 
znRecord.getSimpleField(CommonConstants.Helix.Instance.ADMIN_PORT_KEY);
+        InstanceConfig instanceConfig = new InstanceConfig(znRecord);
+        String[] hostnameSplit = instanceConfig.getHostName().split("_");
+        String adminEndpoint =  hostnameSplit[1] + ":" + adminPort;
+        Assert.assertTrue(endpoints.inverse().containsKey(adminEndpoint));
+      }
+    }
+  }
+
+  @Test
+  public void testGetInstanceConfigsFromZkCacheBaseDataAccessor() {
 
 Review comment:
   Isnt this test a duplicate of lines 86 through 97?
   
   Also, can u add a test (or tests) where a new instance is added and an old 
one removed, and the cached data accessor shows the modifiction correctly? I 
think it is worth the effort.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to