HBASE-13668 TestFlushRegionEntry is flaky
This commit is contained in:
parent
3fa0bf3cb6
commit
f49111e5f8
|
@ -10,31 +10,42 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase.regionserver;
|
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.RegionServerTests;
|
||||||
import org.apache.hadoop.hbase.testclassification.SmallTests;
|
import org.apache.hadoop.hbase.testclassification.MediumTests;
|
||||||
import org.apache.hadoop.hbase.regionserver.MemStoreFlusher.FlushRegionEntry;
|
|
||||||
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
|
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
|
||||||
import org.apache.hadoop.hbase.util.ManualEnvironmentEdge;
|
import org.apache.hadoop.hbase.util.ManualEnvironmentEdge;
|
||||||
import org.junit.After;
|
import org.apache.hadoop.hbase.regionserver.MemStoreFlusher.FlushRegionEntry;
|
||||||
import org.junit.Before;
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.experimental.categories.Category;
|
import org.junit.experimental.categories.Category;
|
||||||
import org.mockito.Mockito;
|
|
||||||
|
|
||||||
@Category({RegionServerTests.class, SmallTests.class})
|
@Category({RegionServerTests.class, MediumTests.class})
|
||||||
public class TestFlushRegionEntry {
|
public class TestFlushRegionEntry {
|
||||||
@Before
|
|
||||||
public void setUp() throws Exception {
|
@BeforeClass
|
||||||
|
public static void setUp() throws Exception {
|
||||||
ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
|
ManualEnvironmentEdge edge = new ManualEnvironmentEdge();
|
||||||
edge.setValue(12345);
|
edge.setValue(12345);
|
||||||
EnvironmentEdgeManager.injectEdge(edge);
|
EnvironmentEdgeManager.injectEdge(edge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void teardown() {
|
||||||
|
EnvironmentEdgeManager.reset();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test() {
|
public void testFlushRegionEntryEquality() {
|
||||||
HRegion r = Mockito.mock(HRegion.class);
|
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 entry = new FlushRegionEntry(r, true);
|
||||||
FlushRegionEntry other = new FlushRegionEntry(r, true);
|
FlushRegionEntry other = new FlushRegionEntry(r, true);
|
||||||
|
|
||||||
|
@ -42,8 +53,4 @@ public class TestFlushRegionEntry {
|
||||||
assertEquals(entry, other);
|
assertEquals(entry, other);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
|
||||||
public void teardown() {
|
|
||||||
EnvironmentEdgeManager.reset();
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue