hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject [2/4] hbase git commit: HBASE-13309 Some tests do not reset EnvironmentEdgeManager
Date Sun, 22 Mar 2015 10:56:54 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/f3f42bf7
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/f3f42bf7
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/f3f42bf7

Branch: refs/heads/branch-1
Commit: f3f42bf7a68eb9d38fd5c636e3ee066b931e48c5
Parents: bbf9a90
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:43:15 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/f3f42bf7/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 51784e9..2a13b7d 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
@@ -323,15 +323,18 @@ 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/f3f42bf7/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 ef9e1c5..01a74e1 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
@@ -119,6 +119,7 @@ import org.apache.hadoop.hbase.zookeeper.ZKAssign;
 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;
@@ -189,6 +190,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