private void rebalance() throws Exception {
    ResourceManager resourceManager = cacheRule.getCache().getResourceManager();
    RebalanceFactory rebalanceFactory = resourceManager.createRebalanceFactory();
    RebalanceOperation rebalanceOperation = rebalanceFactory.start();

    // wait for rebalance to complete
    assertThat(rebalanceOperation.getResults()).isNotNull();
  }
Rebalance the region, waiting for the rebalance operation to complete
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/partitioned/BucketRebalanceStatRegressionTest.java