hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject [43/44] hbase git commit: HBASE-13309 Some tests do not reset EnvironmentEdgeManager
Date Mon, 23 Mar 2015 22:23:28 GMT
HBASE-13309 Some tests do not reset EnvironmentEdgeManager


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

Branch: refs/heads/hbase-12439
Commit: 845f5de121e92a99b41b30dc86cb3f2898e0254f
Parents: a9b73b6
Author: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Authored: Sun Mar 22 10:40:49 2015 +0000
Committer: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Committed: Sun Mar 22 10:40:49 2015 +0000

----------------------------------------------------------------------
 .../apache/hadoop/hbase/util/TestFSUtils.java    | 19 +++++++++++--------
 .../apache/hadoop/hbase/util/TestHBaseFsck.java  |  6 ++++++
 2 files changed, 17 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/845f5de1/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSUtils.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSUtils.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSUtils.java
index c8b2285..e2c1488 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSUtils.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestFSUtils.java
@@ -330,16 +330,19 @@ public class TestFSUtils {
     ManualEnvironmentEdge mockEnv = new ManualEnvironmentEdge();
     mockEnv.setValue(expect);
     EnvironmentEdgeManager.injectEdge(mockEnv);
+    try {
+      String dstFile = UUID.randomUUID().toString();
+      Path dst = new Path(testDir , dstFile);
 
-    String dstFile = UUID.randomUUID().toString();
-    Path dst = new Path(testDir , dstFile);
-
-    assertTrue(FSUtils.renameAndSetModifyTime(fs, p, dst));
-    assertFalse("The moved file should not be present", FSUtils.isExists(fs, p));
-    assertTrue("The dst file should be present", FSUtils.isExists(fs, dst));
+      assertTrue(FSUtils.renameAndSetModifyTime(fs, p, dst));
+      assertFalse("The moved file should not be present", FSUtils.isExists(fs, p));
+      assertTrue("The dst file should be present", FSUtils.isExists(fs, dst));
 
-    assertEquals(expect, fs.getFileStatus(dst).getModificationTime());
-    cluster.shutdown();
+      assertEquals(expect, fs.getFileStatus(dst).getModificationTime());
+      cluster.shutdown();
+    } finally {
+      EnvironmentEdgeManager.reset();
+    }
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/845f5de1/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
index ba7ba9c..ac2d906 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
@@ -111,6 +111,7 @@ import org.apache.hadoop.hbase.zookeeper.MetaTableLocator;
 import org.apache.zookeeper.KeeperException;
 import org.junit.AfterClass;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -182,6 +183,11 @@ public class TestHBaseFsck {
     TEST_UTIL.shutdownMiniCluster();
   }
 
+  @Before
+  public void setUp() {
+    EnvironmentEdgeManager.reset();
+  }
+
   @Test (timeout=180000)
   public void testHBaseFsck() throws Exception {
     assertNoErrors(doFsck(conf, false));


Mime
View raw message