From f36587c6486468f6b19f7419c9a263ed81d8bdc7 Mon Sep 17 00:00:00 2001 From: Nick Dimiduk Date: Fri, 7 Apr 2023 23:02:09 -0400 Subject: [PATCH] HBASE-27720 TestClusterRestartFailover is flakey due to metrics assertion (#5110) Signed-off-by: Duo Zhang --- .../hadoop/hbase/master/TestClusterRestartFailover.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestClusterRestartFailover.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestClusterRestartFailover.java index 802ed2c6d04c..69d81a986fe8 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestClusterRestartFailover.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestClusterRestartFailover.java @@ -141,6 +141,12 @@ private void setupCluster() throws Exception { LOG.info("Setup cluster"); UTIL.startMiniCluster(StartTestingClusterOption.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");