Source:
<code>public void testDisablePartitionAndStopInstance() throws Exception { HelixClusterVerifier bestPossibleVerifier = new BestPossibleExternalViewVerifier.Builder(_clusterName).setZkClient(_gZkClient).build(); Assert.assertTrue(bestPossibleVerifier.verify(10000)); HelixClusterVerifier strictMatchVerifier = new StrictMatchExternalViewVerifier.Builder(_clusterName).setZkClient(_gZkClient).build(); Assert.assertTrue(strictMatchVerifier.verify(10000)); _admin.enablePartition(false, _clusterName, _participants[0].getInstanceName(), FULL_AUTO_RESOURCES[0], Lists.newArrayList(FULL_AUTO_RESOURCES[0] + "_0")); <START> <END> boolean isVerifiedFalse = TestHelper.verify(() -> { HelixClusterVerifier strictMatchVerifierTemp = new StrictMatchExternalViewVerifier.Builder(_clusterName).setZkClient(_gZkClient).build(); boolean verified = strictMatchVerifierTemp.verify(3000); return (!verified); }, 60 * 1000); Assert.assertTrue(isVerifiedFalse); _admin.enablePartition(true, _clusterName, _participants[0].getInstanceName(), FULL_AUTO_RESOURCES[0], Lists.newArrayList(FULL_AUTO_RESOURCES[0] + "_0")); Thread.sleep(1000); Assert.assertTrue(strictMatchVerifier.verify(10000)); _participants[0].syncStop(); Thread.sleep(1000); for (String resource : SEMI_AUTO_RESOURCES) { System.out.println("Un-verify resource: " + resource); strictMatchVerifier = new StrictMatchExternalViewVerifier.Builder(_clusterName) .setZkClient(_gZkClient).setResources(Sets.newHashSet(resource)).build(); Assert.assertFalse(strictMatchVerifier.verify(3000)); } strictMatchVerifier = new StrictMatchExternalViewVerifier.Builder(_clusterName) .setZkClient(_gZkClient).setResources(Sets.newHashSet(FULL_AUTO_RESOURCES)).build(); Assert.assertTrue(strictMatchVerifier.verify(10000)); }</code><technical_language>Please refer change in wagedRebalancer branch, bestPossibleVerifier solve problem. if is related I changed, please try one</technical_language>

Target:
public void testDisablePartitionAndStopInstance() throws Exception { HelixClusterVerifier bestPossibleVerifier = new BestPossibleExternalViewVerifier.Builder(_clusterName).setZkClient(_gZkClient).build(); Assert.assertTrue(bestPossibleVerifier.verify(10000)); HelixClusterVerifier strictMatchVerifier = new StrictMatchExternalViewVerifier.Builder(_clusterName).setZkClient(_gZkClient).build(); Assert.assertTrue(strictMatchVerifier.verify(10000)); _admin.enablePartition(false, _clusterName, _participants[0].getInstanceName(), FULL_AUTO_RESOURCES[0], Lists.newArrayList(FULL_AUTO_RESOURCES[0] + "_0")); boolean isVerifiedFalse = TestHelper.verify(() -> { HelixClusterVerifier strictMatchVerifierTemp = new StrictMatchExternalViewVerifier.Builder(_clusterName).setZkClient(_gZkClient).build(); boolean verified = strictMatchVerifierTemp.verify(3000); return (!verified); }, TestHelper.WAIT_DURATION); Assert.assertTrue(isVerifiedFalse); _admin.enablePartition(true, _clusterName, _participants[0].getInstanceName(), FULL_AUTO_RESOURCES[0], Lists.newArrayList(FULL_AUTO_RESOURCES[0] + "_0")); Thread.sleep(1000); Assert.assertTrue(strictMatchVerifier.verify(10000)); _participants[0].syncStop(); Thread.sleep(1000); for (String resource : SEMI_AUTO_RESOURCES) { System.out.println("Un-verify resource: " + resource); strictMatchVerifier = new StrictMatchExternalViewVerifier.Builder(_clusterName) .setZkClient(_gZkClient).setResources(Sets.newHashSet(resource)).build(); Assert.assertFalse(strictMatchVerifier.verify(3000)); } strictMatchVerifier = new StrictMatchExternalViewVerifier.Builder(_clusterName) .setZkClient(_gZkClient).setResources(Sets.newHashSet(FULL_AUTO_RESOURCES)).build(); Assert.assertTrue(strictMatchVerifier.verify(10000)); }