PHOENIX-2575 Prevent LocalIndexIT from hanging indefinitely
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/fb74af1e Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/fb74af1e Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/fb74af1e Branch: refs/heads/4.x-HBase-1.0 Commit: fb74af1ef0ac9a0d0ee172cb1ecfed55abdb4ddc Parents: 3d36dba Author: Samarth <[email protected]> Authored: Wed Jan 6 18:55:58 2016 -0800 Committer: Samarth <[email protected]> Committed: Wed Jan 6 18:55:58 2016 -0800 ---------------------------------------------------------------------- .../java/org/apache/phoenix/end2end/index/LocalIndexIT.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/phoenix/blob/fb74af1e/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java ---------------------------------------------------------------------- diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java index ee523de..8190f64 100644 --- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java +++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java @@ -34,6 +34,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HTableDescriptor; @@ -82,6 +83,7 @@ public class LocalIndexIT extends BaseHBaseManagedTimeIT { private static CountDownLatch latch1 = new CountDownLatch(1); private static CountDownLatch latch2 = new CountDownLatch(1); + private static final int WAIT_TIME_SECONDS = 60; @BeforeClass @Shadower(classBeingShadowed = BaseHBaseManagedTimeIT.class) @@ -967,7 +969,8 @@ public class LocalIndexIT extends BaseHBaseManagedTimeIT { } assertEquals(5, regionsOfIndexTable.size()); - latch1.await(); + boolean success = latch1.await(WAIT_TIME_SECONDS, TimeUnit.SECONDS); + assertTrue("Timed out waiting for MockedLocalIndexSplitter.preSplitAfterPONR to complete", success); // Verify the metadata for index is correct. rs = conn1.getMetaData().getTables(null, StringUtil.escapeLike(TestUtil.DEFAULT_SCHEMA_NAME), TestUtil.DEFAULT_INDEX_TABLE_NAME, new String[] { PTableType.INDEX.toString() }); @@ -999,7 +1002,8 @@ public class LocalIndexIT extends BaseHBaseManagedTimeIT { public void postCompact(ObserverContext<RegionCoprocessorEnvironment> e, Store store, StoreFile resultFile) throws IOException { try { - latch2.await(); + boolean success = latch2.await(WAIT_TIME_SECONDS, TimeUnit.SECONDS); + assertTrue("Timed out waiting for test to complete", success); } catch (InterruptedException e1) { } super.postCompact(e, store, resultFile);
