HBASE-26805 TestRegionHDFSBlockLocationFinder is flaky (#4169)

Signed-off-by: GeorryHuang <huangzhuoyue@apache.org>
This commit is contained in:
Duo Zhang 2022-03-07 08:08:04 +08:00 committed by GitHub
parent 2b205d2230
commit 480db06e46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -209,7 +209,7 @@ public class TestRegionHDFSBlockLocationFinder {
}
@Test
public void testRefreshRegionsWithChangedLocality() {
public void testRefreshRegionsWithChangedLocality() throws InterruptedException {
ServerName testServer = ServerName.valueOf("host-0", 12345, 12345);
RegionInfo testRegion = REGIONS.get(0);
@ -231,7 +231,9 @@ public class TestRegionHDFSBlockLocationFinder {
finder.setClusterMetrics(getMetricsWithLocality(testServer, testRegion.getRegionName(),
0.345f));
// there is no way to test whether the refresh for a guava cache is finished, so here we just
// add a one second sleep, usually this is enough for the refresh
Thread.sleep(1000);
// locality changed just for our test region, so it should no longer be the same
for (RegionInfo region : REGIONS) {
HDFSBlocksDistribution hbd = finder.getBlockDistribution(region);