HBASE-13668 TestFlushRegionEntry is flaky

This commit is contained in:
Andrew Purtell 2015-05-16 11:20:04 -07:00
parent 3fa0bf3cb6
commit f49111e5f8
1 changed files with 22 additions and 15 deletions

View File

@ -10,31 +10,42 @@
*/
package org.apache.hadoop.hbase.regionserver;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.*;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.regionserver.MemStoreFlusher.FlushRegionEntry;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.hbase.util.ManualEnvironmentEdge;
import org.junit.After;
import org.junit.Before;
import org.apache.hadoop.hbase.regionserver.MemStoreFlusher.FlushRegionEntry;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mockito.Mockito;
@Category({RegionServerTests.class, SmallTests.class})
@Category({RegionServerTests.class, MediumTests.class})
public class TestFlushRegionEntry {
@Before
public void setUp() throws Exception {
@BeforeClass
public static void setUp() throws Exception {
ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
edge.setValue(12345);
EnvironmentEdgeManager.injectEdge(edge);
}
@AfterClass
public static void teardown() {
EnvironmentEdgeManager.reset();
}
@Test
public void test() {
HRegion r = Mockito.mock(HRegion.class);
public void testFlushRegionEntryEquality() {
HRegionInfo hri = new HRegionInfo(1, TableName.valueOf("TestTable"), 0);
HRegion r = mock(HRegion.class);
doReturn(hri).when(r).getRegionInfo();
FlushRegionEntry entry = new FlushRegionEntry(r, true);
FlushRegionEntry other = new FlushRegionEntry(r, true);
@ -42,8 +53,4 @@ public class TestFlushRegionEntry {
assertEquals(entry, other);
}
@After
public void teardown() {
EnvironmentEdgeManager.reset();
}
}