HBASE-13309 Some tests do not reset EnvironmentEdgeManager

This commit is contained in:
Matteo Bertozzi 2015-03-22 10:40:49 +00:00
parent a9b73b600e
commit 845f5de121
2 changed files with 17 additions and 8 deletions

View File

@ -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();
}
}
/**

View File

@ -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));