From 5c209f2cec19d179702f104f6758c3bcb1512eb6 Mon Sep 17 00:00:00 2001 From: Peter Somogyi Date: Fri, 30 Nov 2018 16:39:36 +0100 Subject: [PATCH] HBASE-21479 Individual tests in TestHRegionReplayEvents class are failing Signed-off-by: Michael Stack --- .../regionserver/TestHRegionReplayEvents.java | 32 ++++++++++++++-------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java index 308dc03114..3b3b8c39db 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegionReplayEvents.java @@ -66,7 +66,7 @@ import org.apache.hadoop.hbase.io.hfile.HFileContext; import org.apache.hadoop.hbase.regionserver.HRegion.FlushResultImpl; import org.apache.hadoop.hbase.regionserver.HRegion.PrepareFlushResult; import org.apache.hadoop.hbase.regionserver.throttle.NoLimitThroughputController; -import org.apache.hadoop.hbase.testclassification.MediumTests; +import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; import org.apache.hadoop.hbase.util.EnvironmentEdgeManagerTestHelper; @@ -80,7 +80,9 @@ import org.apache.hadoop.hbase.wal.WALKeyImpl; import org.apache.hadoop.hbase.wal.WALSplitter.MutationReplay; import org.apache.hadoop.util.StringUtils; import org.junit.After; +import org.junit.AfterClass; import org.junit.Before; +import org.junit.BeforeClass; import org.junit.ClassRule; import org.junit.Rule; import org.junit.Test; @@ -108,7 +110,7 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.WALProtos.StoreDescript * Tests of HRegion methods for replaying flush, compaction, region open, etc events for secondary * region replicas */ -@Category(MediumTests.class) +@Category(LargeTests.class) public class TestHRegionReplayEvents { @ClassRule @@ -120,7 +122,7 @@ public class TestHRegionReplayEvents { private static HBaseTestingUtility TEST_UTIL; - public static Configuration CONF ; + public static Configuration CONF; private String dir; private byte[][] families = new byte[][] { @@ -136,17 +138,27 @@ public class TestHRegionReplayEvents { // per test fields private Path rootDir; private TableDescriptor htd; - private long time; private RegionServerServices rss; private RegionInfo primaryHri, secondaryHri; private HRegion primaryRegion, secondaryRegion; - private WALFactory wals; private WAL walPrimary, walSecondary; private WAL.Reader reader; + @BeforeClass + public static void setUpBeforeClass() throws Exception { + TEST_UTIL = new HBaseTestingUtility(); + TEST_UTIL.startMiniDFSCluster(1); + } + + @AfterClass + public static void tearDownAfterClass() throws Exception { + LOG.info("Cleaning test directory: " + TEST_UTIL.getDataTestDir()); + TEST_UTIL.cleanupTestDir(); + TEST_UTIL.shutdownMiniDFSCluster(); + } + @Before - public void setup() throws IOException { - TEST_UTIL = HBaseTestingUtility.createLocalHTU(); + public void setUp() throws Exception { CONF = TEST_UTIL.getConfiguration(); dir = TEST_UTIL.getDataTestDir("TestHRegionReplayEvents").toString(); method = name.getMethodName(); @@ -160,14 +172,14 @@ public class TestHRegionReplayEvents { } htd = builder.build(); - time = System.currentTimeMillis(); + long time = System.currentTimeMillis(); ChunkCreator.initialize(MemStoreLABImpl.CHUNK_SIZE_DEFAULT, false, 0, 0, 0, null); primaryHri = RegionInfoBuilder.newBuilder(htd.getTableName()).setRegionId(time).setReplicaId(0).build(); secondaryHri = RegionInfoBuilder.newBuilder(htd.getTableName()).setRegionId(time).setReplicaId(1).build(); - wals = TestHRegion.createWALFactory(CONF, rootDir); + WALFactory wals = TestHRegion.createWALFactory(CONF, rootDir); walPrimary = wals.getWAL(primaryHri); walSecondary = wals.getWAL(secondaryHri); @@ -207,8 +219,6 @@ public class TestHRegionReplayEvents { } EnvironmentEdgeManagerTestHelper.reset(); - LOG.info("Cleaning test directory: " + TEST_UTIL.getDataTestDir()); - TEST_UTIL.cleanupTestDir(); } String getName() { -- 2.11.4.GIT