HBASE-27720 TestClusterRestartFailover is flakey due to metrics assertion (#5110)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
(cherry picked from commit f36587c648)
This commit is contained in:
Nick Dimiduk 2023-04-07 23:02:09 -04:00 committed by Duo Zhang
parent 62ea717b31
commit f8c234e8d0
1 changed files with 6 additions and 0 deletions

View File

@ -152,6 +152,12 @@ public class TestClusterRestartFailover extends AbstractTestRestartCluster {
LOG.info("Setup cluster");
UTIL.startMiniCluster(StartMiniClusterOption.builder().masterClass(HMasterForTest.class)
.numMasters(1).numRegionServers(3).build());
// this test has been flaky. When it is rerun by surefire, the underlying minicluster isn't
// completely cleaned. specifically, the metrics system isn't reset. The result is an otherwise
// successful re-run is failed because there's 8 or 12 SCPcounts instead of the 4 that a
// single run of the test would otherwise produce. Thus, explicitly reset the metrics source
// each time we setup the cluster.
UTIL.getMiniHBaseCluster().getMaster().getMasterMetrics().getMetricsSource().init();
LOG.info("Cluster is up");
UTIL.waitFor(60000, () -> UTIL.getMiniHBaseCluster().getMaster().isInitialized());
LOG.info("Master is up");