hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject [3/5] hbase git commit: HBASE-13668 TestFlushRegionEntry is flaky
Date Sat, 16 May 2015 23:46:56 GMT
HBASE-13668 TestFlushRegionEntry is flaky

Conflicts:
	hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFlushRegionEntry.java


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/135dc6a9
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/135dc6a9
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/135dc6a9

Branch: refs/heads/branch-1.1
Commit: 135dc6a9d371fe05011de25246d6e3e7d2f7bbe5
Parents: 0aafae4
Author: Andrew Purtell <apurtell@apache.org>
Authored: Sat May 16 11:20:04 2015 -0700
Committer: Andrew Purtell <apurtell@apache.org>
Committed: Sat May 16 16:24:07 2015 -0700

----------------------------------------------------------------------
 .../regionserver/TestFlushRegionEntry.java      | 37 ++++++++++++--------
 1 file changed, 22 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/135dc6a9/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFlushRegionEntry.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFlushRegionEntry.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFlushRegionEntry.java
index 0a2bbc2..66f30f3 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFlushRegionEntry.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestFlushRegionEntry.java
@@ -10,30 +10,41 @@
  */
 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.testclassification.SmallTests;
-import org.apache.hadoop.hbase.regionserver.MemStoreFlusher.FlushRegionEntry;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.TableName;
+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(SmallTests.class)
+@Category(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);
 
@@ -41,8 +52,4 @@ public class TestFlushRegionEntry {
     assertEquals(entry, other);
   }
 
-  @After
-  public void teardown() {
-    EnvironmentEdgeManager.reset();
-  }
 }
\ No newline at end of file


Mime
View raw message