HBASE-25122 [Flake Test][branch-1] TestExportSnapshotWithTemporaryDirectory (#2472)

* Remove unused imports

Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
Reid Chan 2020-09-30 18:55:28 +08:00 committed by GitHub
parent e76e7c93d5
commit 6edeb5d1ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 18 deletions

View File

@ -40,8 +40,6 @@ import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.master.snapshot.SnapshotManager;
import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
import org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotFileInfo;
@ -67,7 +65,7 @@ import org.junit.rules.TestRule;
public class TestExportSnapshot {
@Rule public final TestRule timeout = CategoryBasedTimeout.builder().
withTimeout(this.getClass()).withLookingForStuckThread(true).build();
private static final Log LOG = LogFactory.getLog(TestExportSnapshot.class);
protected static final Log LOG = LogFactory.getLog(TestExportSnapshot.class);
protected final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
@ -79,7 +77,7 @@ public class TestExportSnapshot {
private TableName tableName;
private Admin admin;
public static void setUpBaseConf(Configuration conf) {
public static void setUpBaseConf(Configuration conf) throws Exception {
conf.setBoolean(SnapshotManager.HBASE_SNAPSHOT_ENABLED, true);
conf.setInt("hbase.regionserver.msginterval", 100);
conf.setInt("hbase.client.pause", 250);

View File

@ -17,10 +17,6 @@
*/
package org.apache.hadoop.hbase.snapshot;
import java.io.File;
import java.nio.file.Paths;
import java.util.UUID;
import org.apache.commons.io.FileUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.testclassification.MediumTests;
@ -31,24 +27,21 @@ import org.junit.experimental.categories.Category;
@Category({MediumTests.class})
public class TestExportSnapshotWithTemporaryDirectory extends TestExportSnapshot {
protected static String TEMP_DIR = Paths.get("").toAbsolutePath().toString() + Path.SEPARATOR
+ UUID.randomUUID().toString();
@BeforeClass
public static void setUpBeforeClass() throws Exception {
setUpBaseConf(TEST_UTIL.getConfiguration());
Configuration conf = TEST_UTIL.getConfiguration();
TestExportSnapshot.setUpBaseConf(conf);
TEST_UTIL.startMiniCluster(3);
Path rootDir = TEST_UTIL.getMiniHBaseCluster().getMaster().getMasterFileSystem().getRootDir();
LOG.info("Root dir: " + rootDir);
conf.set(SnapshotDescriptionUtils.SNAPSHOT_WORKING_DIR,
new Path(rootDir.getParent(), ".tmpdir").toUri().toString());
TEST_UTIL.startMiniMapReduceCluster();
}
@AfterClass
public static void tearDownAfterClass() throws Exception {
TestExportSnapshot.tearDownAfterClass();
FileUtils.deleteDirectory(new File(TEMP_DIR));
}
public static void setUpBaseConf(Configuration conf) {
TestExportSnapshot.setUpBaseConf(conf);
conf.set(SnapshotDescriptionUtils.SNAPSHOT_WORKING_DIR, "file://" + new Path(TEMP_DIR, ".tmpdir").toUri());
}
}
}