HADOOP-8766. FileContextMainOperationsBaseTest should randomize the root dir. Contributed by Colin Patrick McCabe.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1381438 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Aaron Myers 2012-09-05 23:17:27 +00:00
parent bcf79c727e
commit 7eb7af2cb8
2 changed files with 15 additions and 4 deletions

View File

@ -257,6 +257,9 @@ Release 2.0.1-alpha - UNRELEASED
HADOOP-8648. libhadoop: native CRC32 validation crashes when HADOOP-8648. libhadoop: native CRC32 validation crashes when
io.bytes.per.checksum=1. (Colin Patrick McCabe via eli) io.bytes.per.checksum=1. (Colin Patrick McCabe via eli)
HADOOP-8766. FileContextMainOperationsBaseTest should randomize the root
dir. (Colin Patrick McCabe via atm)
BREAKDOWN OF HDFS-3042 SUBTASKS BREAKDOWN OF HDFS-3042 SUBTASKS
HADOOP-8220. ZKFailoverController doesn't handle failure to become active HADOOP-8220. ZKFailoverController doesn't handle failure to become active

View File

@ -18,6 +18,7 @@
package org.apache.hadoop.fs; package org.apache.hadoop.fs;
import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.EnumSet; import java.util.EnumSet;
@ -61,8 +62,15 @@ public abstract class FileContextMainOperationsBaseTest {
private static String TEST_DIR_AXX = "test/hadoop/axx"; private static String TEST_DIR_AXX = "test/hadoop/axx";
private static int numBlocks = 2; private static int numBlocks = 2;
static final String LOCAL_FS_ROOT_URI = "file:///tmp/test"; public static final Path LOCAL_FS_ROOT_PATH;
static {
File testBuildData = new File(System.getProperty("test.build.data",
"build/test/data"));
Path localFsRootPath = new Path(testBuildData.getAbsolutePath(),
"root-uri");
LOCAL_FS_ROOT_PATH = localFsRootPath.makeQualified(LocalFileSystem.NAME, null);
}
protected static FileContext fc; protected static FileContext fc;
@ -95,7 +103,7 @@ public abstract class FileContextMainOperationsBaseTest {
@After @After
public void tearDown() throws Exception { public void tearDown() throws Exception {
fc.delete(new Path(getAbsoluteTestRootPath(fc), new Path("test")), true); fc.delete(new Path(getAbsoluteTestRootPath(fc), new Path("test")), true);
fc.delete(new Path(LOCAL_FS_ROOT_URI), true); fc.delete(LOCAL_FS_ROOT_PATH, true);
} }
@ -176,7 +184,7 @@ public abstract class FileContextMainOperationsBaseTest {
// Try a URI // Try a URI
absoluteDir = new Path(LOCAL_FS_ROOT_URI + "/existingDir"); absoluteDir = new Path(LOCAL_FS_ROOT_PATH, "existingDir");
fc.mkdir(absoluteDir, FileContext.DEFAULT_PERM, true); fc.mkdir(absoluteDir, FileContext.DEFAULT_PERM, true);
fc.setWorkingDirectory(absoluteDir); fc.setWorkingDirectory(absoluteDir);
Assert.assertEquals(absoluteDir, fc.getWorkingDirectory()); Assert.assertEquals(absoluteDir, fc.getWorkingDirectory());