HBASE-4162 Fix TestHRegionInfo.testGetSetOfHTD: delete /tmp/hbase-<username> if it already exists.
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1154658 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
df4059d36c
commit
678a53a6d2
|
@ -190,6 +190,8 @@ Release 0.91.0 - Unreleased
|
|||
HBASE-4159 HBaseServer - IPC Reader threads are not daemons (Douglas
|
||||
Campbell)
|
||||
HBASE-4171 HBase shell broken in trunk (Lars Hofhansl)
|
||||
HBASE-4162 Fix TestHRegionInfo.testGetSetOfHTD: delete /tmp/hbase-<username>
|
||||
if it already exists (Mikhail Bautin)
|
||||
|
||||
IMPROVEMENTS
|
||||
HBASE-3290 Max Compaction Size (Nicolas Spiegelberg via Stack)
|
||||
|
|
|
@ -1003,6 +1003,18 @@ public class FSUtils {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a table's directory from the file system if exists. Used in unit
|
||||
* tests.
|
||||
*/
|
||||
public static void deleteTableDescriptorIfExists(String tableName,
|
||||
Configuration conf) throws IOException {
|
||||
FileSystem fs = getCurrentFileSystem(conf);
|
||||
Path tableInfoPath = getTableInfoPath(getRootDir(conf), tableName);
|
||||
if (fs.exists(tableInfoPath))
|
||||
deleteDirectory(fs, tableInfoPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when we are creating a table to write out the tables' descriptor.
|
||||
* @param fs
|
||||
|
|
|
@ -25,6 +25,8 @@ import static org.junit.Assert.assertNull;
|
|||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||
import org.apache.hadoop.hbase.HConstants;
|
||||
import org.apache.hadoop.hbase.HRegionInfo;
|
||||
|
@ -60,9 +62,15 @@ public class TestHRegionInfo {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testGetSetOfHTD() {
|
||||
public void testGetSetOfHTD() throws IOException {
|
||||
HBaseTestingUtility HTU = new HBaseTestingUtility();
|
||||
final String tablename = "testGetSetOfHTD";
|
||||
|
||||
// Delete the temporary table directory that might still be there from the
|
||||
// previous test run.
|
||||
FSUtils.deleteTableDescriptorIfExists(tablename,
|
||||
HTU.getConfiguration());
|
||||
|
||||
HTableDescriptor htd = new HTableDescriptor(tablename);
|
||||
FSUtils.createTableDescriptor(htd, HTU.getConfiguration());
|
||||
HRegionInfo hri = new HRegionInfo(Bytes.toBytes("testGetSetOfHTD"),
|
||||
|
|
Loading…
Reference in New Issue