kaisun2000 commented on a change in pull request #1227:
URL: https://github.com/apache/helix/pull/1227#discussion_r504342326



##########
File path: 
helix-core/src/test/java/org/apache/helix/tools/TestClusterStateVerifier.java
##########
@@ -114,19 +118,30 @@ public void testResourceSubset() throws 
InterruptedException {
     Thread.sleep(1000);
     _admin.enableCluster(_clusterName, false);
     _admin.enableInstance(_clusterName, "localhost_12918", true);
-    boolean result =
-        ClusterStateVerifier.verifyByZkCallback(new 
BestPossAndExtViewZkVerifier(ZK_ADDR,
-            _clusterName, null, Sets.newHashSet(RESOURCES[1])));
-    Assert.assertTrue(result);
+    BestPossAndExtViewZkVerifier verifier = new 
BestPossAndExtViewZkVerifier(ZK_ADDR,
+        _clusterName, null, Sets.newHashSet(RESOURCES[1]));
+    boolean result = false;
+    try {
+      result = ClusterStateVerifier.verifyByZkCallback(verifier);
+      Assert.assertTrue(result);
+    } finally {
+      verifier.close();
+    }
+
     String[] args = {
         "--zkSvr", ZK_ADDR, "--cluster", _clusterName, "--resources", 
RESOURCES[1]
     };
     result = ClusterStateVerifier.verifyState(args);
     Assert.assertTrue(result);
 
     // But the full cluster verification should fail
-    boolean fullResult = new BestPossAndExtViewZkVerifier(ZK_ADDR, 
_clusterName).verify();
-    Assert.assertFalse(fullResult);
+    BestPossAndExtViewZkVerifier verifier1 = new 
BestPossAndExtViewZkVerifier(ZK_ADDR, _clusterName);

Review comment:
       changed to this:
   ```
       verifier = new BestPossAndExtViewZkVerifier(ZK_ADDR, _clusterName);
       try {
         boolean fullResult = verifier.verify();
         Assert.assertFalse(fullResult);
       } finally {
         verifier.close();
       }
   ```




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



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

Reply via email to