From 6375de9695f806f914bd6fecda530a6a16d83578 Mon Sep 17 00:00:00 2001 From: Todd Lipcon Date: Wed, 14 Sep 2011 19:28:30 +0000 Subject: [PATCH] HBASE-4406 TestOpenRegionHandler failing after HBASE-4287 git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1170792 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 1 + .../handler/TestOpenRegionHandler.java | 23 +++++++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index fff5c79b63d1..d75147d7ce17 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -261,6 +261,7 @@ Release 0.91.0 - Unreleased HBASE-4340 Hbase can't balance if ServerShutdownHandler encountered exception (Jinchao Gao) HBASE-4394 Add support for seeking hints to FilterList + HBASE-4406 TestOpenRegionHandler failing after HBASE-4287 (todd) IMPROVEMENTS HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack) diff --git a/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java b/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java index 02e3d167382e..2c33d6acd4f3 100644 --- a/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java +++ b/src/test/java/org/apache/hadoop/hbase/regionserver/handler/TestOpenRegionHandler.java @@ -37,12 +37,14 @@ import org.apache.hadoop.hbase.executor.EventHandler.EventType; import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.regionserver.RegionServerServices; +import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.zookeeper.ZKAssign; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.KeeperException.NodeExistsException; import org.junit.AfterClass; +import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.mockito.Mockito; @@ -57,9 +59,9 @@ public class TestOpenRegionHandler { private final static HBaseTestingUtility HTU = new HBaseTestingUtility(); private static final HTableDescriptor TEST_HTD = new HTableDescriptor("TestOpenRegionHandler.java"); - private static final HRegionInfo TEST_HRI = - new HRegionInfo(TEST_HTD.getName(), HConstants.EMPTY_END_ROW, - HConstants.EMPTY_END_ROW); + private HRegionInfo TEST_HRI; + + private int testIndex = 0; @BeforeClass public static void before() throws Exception { HTU.startMiniZKCluster(); @@ -69,6 +71,19 @@ public class TestOpenRegionHandler { HTU.shutdownMiniZKCluster(); } + /** + * Before each test, use a different HRI, so the different tests + * don't interfere with each other. This allows us to use just + * a single ZK cluster for the whole suite. + */ + @Before + public void setupHRI() { + TEST_HRI = new HRegionInfo(TEST_HTD.getName(), + Bytes.toBytes(testIndex), + Bytes.toBytes(testIndex + 1)); + testIndex++; + } + /** * Test the openregionhandler can deal with its znode being yanked out from * under it. @@ -164,4 +179,4 @@ boolean updateMeta(final HRegion r) { assertEquals(EventType.RS_ZK_REGION_FAILED_OPEN, data.getEventType()); } -} \ No newline at end of file +}