Source:
<code>public void testCustomCodeRunner() throws Exception { System.out.println("START " + _clusterName + " at " + new Date(System.currentTimeMillis())); int nodeNb = 5; int startPort = 12918; TestHelper.setupCluster(_clusterName, ZK_ADDR, startPort, "localhost", "TestDB", 1, 5, nodeNb, nodeNb, "MasterSlave", true); ClusterControllerManager controller = new ClusterControllerManager(ZK_ADDR, _clusterName, "controller_0"); controller.syncStart(); MockParticipantManager[] participants = new MockParticipantManager[5]; for (int i = 0; i < nodeNb; i++) { String instanceName = "localhost_" + (startPort + i); participants[i] = new MockParticipantManager(ZK_ADDR, _clusterName, instanceName); registerCustomCodeRunner(participants[i]); participants[i].syncStart(); } boolean result = ClusterStateVerifier.verifyByPolling( new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR, _clusterName)); Assert.assertTrue(result); Thread.sleep(1000); Assert.assertTrue(_callback._isCallbackInvoked); _callback._isCallbackInvoked = false; int[] newLiveInstance = new int[]{1000}; setupInstances(_clusterName, newLiveInstance); setupLiveInstances(_clusterName, newLiveInstance); Thread.sleep(1000); Assert.assertTrue(_callback._isCallbackInvoked); controller.syncStop(); for (int i = 0; i < nodeNb; i++) { participants[i].syncStop(); } HelixDataAccessor accessor = new ZKHelixDataAccessor(_clusterName, new ZkBaseDataAccessor<>(_gZkClient)); Builder keyBuilder = accessor.keyBuilder(); <START> accessor.removeProperty(keyBuilder.liveInstance("localhost_1000")); <END> TestHelper.dropCluster(_clusterName, _gZkClient); System.out.println("END " + _clusterName + " at " + new Date(System.currentTimeMillis())); }</code><technical_language>Nit: instanceconfigs deleted end of test. dropCluster() takes care of them? confirm</technical_language>

Target:
public void testCustomCodeRunner() throws Exception { System.out.println("START " + _clusterName + " at " + new Date(System.currentTimeMillis())); int nodeNb = 5; int startPort = 12918; TestHelper.setupCluster(_clusterName, ZK_ADDR, startPort, "localhost", "TestDB", 1, 5, nodeNb, nodeNb, "MasterSlave", true); ClusterControllerManager controller = new ClusterControllerManager(ZK_ADDR, _clusterName, "controller_0"); controller.syncStart(); MockParticipantManager[] participants = new MockParticipantManager[5]; for (int i = 0; i < nodeNb; i++) { String instanceName = "localhost_" + (startPort + i); participants[i] = new MockParticipantManager(ZK_ADDR, _clusterName, instanceName); registerCustomCodeRunner(participants[i]); participants[i].syncStart(); } boolean result = ClusterStateVerifier.verifyByPolling( new ClusterStateVerifier.BestPossAndExtViewZkVerifier(ZK_ADDR, _clusterName)); Assert.assertTrue(result); Thread.sleep(1000); Assert.assertTrue(_callback._isCallbackInvoked); _callback._isCallbackInvoked = false; int[] newLiveInstance = new int[]{1000}; setupInstances(_clusterName, newLiveInstance); setupLiveInstances(_clusterName, newLiveInstance); Thread.sleep(1000); Assert.assertTrue(_callback._isCallbackInvoked); controller.syncStop(); for (int i = 0; i < nodeNb; i++) { participants[i].syncStop(); } deleteLiveInstances(_clusterName); deleteCluster(_clusterName); System.out.println("END " + _clusterName + " at " + new Date(System.currentTimeMillis())); }