Browse Source

HADOOP-9638. Merging change r1492314 from branch-2 to branch-2.1-beta.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2.1-beta@1492322 13f79535-47bb-0310-9956-ffa450edef68
Chris Nauroth 12 years ago
parent
commit
b40387483e

+ 3 - 0
hadoop-common-project/hadoop-common/CHANGES.txt

@@ -232,6 +232,9 @@ Release 2.1.0-beta - UNRELEASED
 
     HADOOP-9581. hadoop --config non-existent directory should result in error
     (Ashwin Shankar via jlowe)
+
+    HADOOP-9638. Parallel test changes caused invalid test path for several HDFS
+    tests on Windows (Andrey Klochkov via cnauroth)
     
     HADOOP-9532. HADOOP_CLIENT_OPTS is appended twice by Windows cmd scripts.
     (Chris Nauroth via suresh)

+ 7 - 1
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextMainOperationsBaseTest.java

@@ -65,7 +65,13 @@ public abstract class FileContextMainOperationsBaseTest  {
 
   public Path localFsRootPath;
 
-  protected final FileContextTestHelper fileContextTestHelper = new FileContextTestHelper();
+  protected final FileContextTestHelper fileContextTestHelper =
+    createFileContextHelper();
+
+  protected FileContextTestHelper createFileContextHelper() {
+    return new FileContextTestHelper();
+  }
+
   protected static FileContext fc;
   
   final private static PathFilter DEFAULT_FILTER = new PathFilter() {

+ 9 - 1
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/FileContextTestHelper.java

@@ -42,7 +42,15 @@ public final class FileContextTestHelper {
    * Create a context with test root relative to the <wd>/build/test/data
    */
   public FileContextTestHelper() {
-      testRootDir = System.getProperty("test.build.data", "target/test/data") + "/" + RandomStringUtils.randomAlphanumeric(10);
+    this(System.getProperty("test.build.data", "target/test/data") + "/" +
+        RandomStringUtils.randomAlphanumeric(10));
+  }
+
+  /**
+   * Create a context with the given test root
+   */
+  public FileContextTestHelper(String testRootDir) {
+    this.testRootDir = testRootDir;
   }
   
   public static int getDefaultBlockSize() {

+ 5 - 1
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java

@@ -75,7 +75,11 @@ public class ViewFsBaseTest {
   Configuration conf;
   FileContext xfcViewWithAuthority; // same as fsView but with authority
   URI schemeWithAuthority;
-  final FileContextTestHelper fileContextTestHelper = new FileContextTestHelper();
+  final FileContextTestHelper fileContextTestHelper = createFileContextHelper();
+
+  protected FileContextTestHelper createFileContextHelper() {
+    return new FileContextTestHelper();
+  }
 
   @Before
   public void setUp() throws Exception {

+ 6 - 0
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsCreateMkdir.java

@@ -38,6 +38,12 @@ public class TestFcHdfsCreateMkdir extends
   private static MiniDFSCluster cluster;
   private static Path defaultWorkingDirectory;
   
+  @Override
+  protected FileContextTestHelper createFileContextHelper() {
+    return new FileContextTestHelper("/tmp/TestFcHdfsCreateMkdir");
+  }
+
+
   @BeforeClass
   public static void clusterSetupAtBegining()
                                     throws IOException, LoginException, URISyntaxException  {

+ 2 - 1
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsPermission.java

@@ -35,7 +35,8 @@ import org.junit.BeforeClass;
 
 public class TestFcHdfsPermission extends FileContextPermissionBase {
   
-  private static final FileContextTestHelper fileContextTestHelper = new FileContextTestHelper();
+  private static final FileContextTestHelper fileContextTestHelper =
+      new FileContextTestHelper("/tmp/TestFcHdfsPermission");
   private static FileContext fc;
 
   private static MiniDFSCluster cluster;

+ 2 - 1
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsSetUMask.java

@@ -42,7 +42,8 @@ import org.junit.Test;
 
 public class TestFcHdfsSetUMask {
   
-  private static FileContextTestHelper fileContextTestHelper = new FileContextTestHelper();
+  private static FileContextTestHelper fileContextTestHelper =
+      new FileContextTestHelper("/tmp/TestFcHdfsSetUMask");
   private static MiniDFSCluster cluster;
   private static Path defaultWorkingDirectory;
   private static FileContext fc;

+ 2 - 1
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsSymlink.java

@@ -50,7 +50,8 @@ public class TestFcHdfsSymlink extends FileContextSymlinkBaseTest {
     ((Log4JLogger)NameNode.stateChangeLog).getLogger().setLevel(Level.ALL);
   }
 
-  private static FileContextTestHelper fileContextTestHelper = new FileContextTestHelper();
+  private static FileContextTestHelper fileContextTestHelper =
+      new FileContextTestHelper("/tmp/TestFcHdfsSymlink");
   private static MiniDFSCluster cluster;
   private static WebHdfsFileSystem webhdfs;
   private static DistributedFileSystem dfs;

+ 5 - 1
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestHDFSFileContextMainOperations.java

@@ -41,11 +41,15 @@ import org.junit.Test;
 
 public class TestHDFSFileContextMainOperations extends
     FileContextMainOperationsBaseTest {
-  private static FileContextTestHelper fileContextTestHelper = new FileContextTestHelper();
   private static MiniDFSCluster cluster;
   private static Path defaultWorkingDirectory;
   private static HdfsConfiguration CONF = new HdfsConfiguration();
   
+  @Override
+  protected FileContextTestHelper createFileContextHelper() {
+    return new FileContextTestHelper("/tmp/TestHDFSFileContextMainOperations");
+  }
+
   @BeforeClass
   public static void clusterSetupAtBegining() throws IOException,
       LoginException, URISyntaxException {

+ 6 - 0
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsAtHdfsRoot.java

@@ -23,6 +23,7 @@ import java.net.URISyntaxException;
 import javax.security.auth.login.LoginException;
 
 import org.apache.hadoop.fs.FileContext;
+import org.apache.hadoop.fs.FileContextTestHelper;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.RemoteIterator;
@@ -43,6 +44,11 @@ public class TestViewFsAtHdfsRoot extends ViewFsBaseTest {
   private static HdfsConfiguration CONF = new HdfsConfiguration();
   private static FileContext fc;
   
+  @Override
+  protected FileContextTestHelper createFileContextHelper() {
+    return new FileContextTestHelper("/tmp/TestViewFsAtHdfsRoot");
+  }
+
   @BeforeClass
   public static void clusterSetupAtBegining() throws IOException,
       LoginException, URISyntaxException {

+ 7 - 0
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsHdfs.java

@@ -24,6 +24,7 @@ import java.net.URISyntaxException;
 import javax.security.auth.login.LoginException;
 
 import org.apache.hadoop.fs.FileContext;
+import org.apache.hadoop.fs.FileContextTestHelper;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hdfs.DFSConfigKeys;
 import org.apache.hadoop.hdfs.HdfsConfiguration;
@@ -39,6 +40,12 @@ public class TestViewFsHdfs extends ViewFsBaseTest {
   private static HdfsConfiguration CONF = new HdfsConfiguration();
   private static FileContext fc;
   
+  @Override
+  protected FileContextTestHelper createFileContextHelper() {
+    return new FileContextTestHelper("/tmp/TestViewFsHdfs");
+  }
+
+
   @BeforeClass
   public static void clusterSetupAtBegining() throws IOException,
       LoginException, URISyntaxException {

+ 4 - 0
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestFSMainOperationsWebHdfs.java

@@ -51,6 +51,10 @@ public class TestFSMainOperationsWebHdfs extends FSMainOperationsBaseTest {
   private static Path defaultWorkingDirectory;
   private static FileSystem fileSystem;
   
+  public TestFSMainOperationsWebHdfs() {
+    super("/tmp/TestFSMainOperationsWebHdfs");
+  }
+
   @Override
   protected FileSystem createFileSystem() throws Exception {
     return fileSystem;