diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java index 238282727ea..bbd9dbe3c3f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java @@ -3045,6 +3045,17 @@ public class HBaseTestingUtility extends HBaseCommonTestingUtility { } finally { meta.close(); } + // So, all regions are in the meta table but make sure master knows of the assignments before + // returing -- sometimes this can lag. + HMaster master = getHBaseCluster().getMaster(); + final RegionStates states = master.getAssignmentManager().getRegionStates(); + waitFor(timeout, 200, new Predicate() { + @Override + public boolean evaluate() throws IOException { + List hris = states.getRegionsOfTable(tableName); + return hris != null && !hris.isEmpty(); + } + }); } /**