You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by jl...@apache.org on 2013/06/04 02:29:40 UTC
svn commit: r1489250 - in
/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop:
fs/ fs/viewfs/ hdfs/web/
Author: jlowe
Date: Tue Jun 4 00:29:37 2013
New Revision: 1489250
URL: http://svn.apache.org/r1489250
Log:
HADOOP-9287. Parallel-testing hadoop-common. Contributed by Andrey Klochkov
Modified:
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsPermission.java
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsSetUMask.java
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsSymlink.java
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestHDFSFileContextMainOperations.java
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemAtHdfsRoot.java
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemHdfs.java
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsFileStatusHdfs.java
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestFSMainOperationsWebHdfs.java
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsPermission.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsPermission.java?rev=1489250&r1=1489249&r2=1489250&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsPermission.java (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsPermission.java Tue Jun 4 00:29:37 2013
@@ -35,9 +35,22 @@ import org.junit.BeforeClass;
public class TestFcHdfsPermission extends FileContextPermissionBase {
+ private static final FileContextTestHelper fileContextTestHelper = new FileContextTestHelper();
+ private static FileContext fc;
+
private static MiniDFSCluster cluster;
private static Path defaultWorkingDirectory;
+ @Override
+ protected FileContextTestHelper getFileContextHelper() {
+ return fileContextTestHelper;
+ }
+
+ @Override
+ protected FileContext getFileContext() {
+ return fc;
+ }
+
@BeforeClass
public static void clusterSetupAtBegining()
throws IOException, LoginException, URISyntaxException {
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsSetUMask.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsSetUMask.java?rev=1489250&r1=1489249&r2=1489250&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsSetUMask.java (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsSetUMask.java Tue Jun 4 00:29:37 2013
@@ -42,6 +42,7 @@ import org.junit.Test;
public class TestFcHdfsSetUMask {
+ private static FileContextTestHelper fileContextTestHelper = new FileContextTestHelper();
private static MiniDFSCluster cluster;
private static Path defaultWorkingDirectory;
private static FileContext fc;
@@ -110,12 +111,12 @@ public class TestFcHdfsSetUMask {
@Before
public void setUp() throws Exception {
fc.setUMask(WIDE_OPEN_TEST_UMASK);
- fc.mkdir(getTestRootPath(fc), FileContext.DEFAULT_PERM, true);
+ fc.mkdir(fileContextTestHelper.getTestRootPath(fc), FileContext.DEFAULT_PERM, true);
}
@After
public void tearDown() throws Exception {
- fc.delete(getTestRootPath(fc), true);
+ fc.delete(fileContextTestHelper.getTestRootPath(fc), true);
}
@Test
@@ -199,7 +200,7 @@ public class TestFcHdfsSetUMask {
public void testMkdirWithExistingDir(FsPermission umask,
FsPermission expectedPerms) throws IOException {
- Path f = getTestRootPath(fc, "aDir");
+ Path f = fileContextTestHelper.getTestRootPath(fc, "aDir");
fc.setUMask(umask);
fc.mkdir(f, FileContext.DEFAULT_PERM, true);
Assert.assertTrue(isDir(fc, f));
@@ -210,13 +211,13 @@ public class TestFcHdfsSetUMask {
public void testMkdirRecursiveWithNonExistingDir(FsPermission umask,
FsPermission expectedPerms, FsPermission expectedParentPerms)
throws IOException {
- Path f = getTestRootPath(fc, "NonExistant2/aDir");
+ Path f = fileContextTestHelper.getTestRootPath(fc, "NonExistant2/aDir");
fc.setUMask(umask);
fc.mkdir(f, FileContext.DEFAULT_PERM, true);
Assert.assertTrue(isDir(fc, f));
Assert.assertEquals("permissions on directory are wrong",
expectedPerms, fc.getFileStatus(f).getPermission());
- Path fParent = getTestRootPath(fc, "NonExistant2");
+ Path fParent = fileContextTestHelper.getTestRootPath(fc, "NonExistant2");
Assert.assertEquals("permissions on parent directory are wrong",
expectedParentPerms, fc.getFileStatus(fParent).getPermission());
}
@@ -224,7 +225,7 @@ public class TestFcHdfsSetUMask {
public void testCreateRecursiveWithExistingDir(FsPermission umask,
FsPermission expectedPerms) throws IOException {
- Path f = getTestRootPath(fc,"foo");
+ Path f = fileContextTestHelper.getTestRootPath(fc,"foo");
fc.setUMask(umask);
createFile(fc, f);
Assert.assertTrue(isFile(fc, f));
@@ -236,8 +237,8 @@ public class TestFcHdfsSetUMask {
public void testCreateRecursiveWithNonExistingDir(FsPermission umask,
FsPermission expectedDirPerms, FsPermission expectedFilePerms)
throws IOException {
- Path f = getTestRootPath(fc,"NonExisting/foo");
- Path fParent = getTestRootPath(fc, "NonExisting");
+ Path f = fileContextTestHelper.getTestRootPath(fc,"NonExisting/foo");
+ Path fParent = fileContextTestHelper.getTestRootPath(fc, "NonExisting");
Assert.assertFalse(exists(fc, fParent));
fc.setUMask(umask);
createFile(fc, f);
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsSymlink.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsSymlink.java?rev=1489250&r1=1489249&r2=1489250&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsSymlink.java (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestFcHdfsSymlink.java Tue Jun 4 00:29:37 2013
@@ -17,7 +17,6 @@
*/
package org.apache.hadoop.fs;
-import static org.apache.hadoop.fs.FileContextTestHelper.getAbsoluteTestRootDir;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
@@ -51,10 +50,10 @@ public class TestFcHdfsSymlink extends F
((Log4JLogger)NameNode.stateChangeLog).getLogger().setLevel(Level.ALL);
}
+ private static FileContextTestHelper fileContextTestHelper = new FileContextTestHelper();
private static MiniDFSCluster cluster;
private static WebHdfsFileSystem webhdfs;
private static DistributedFileSystem dfs;
-
@Override
protected String getScheme() {
@@ -103,10 +102,10 @@ public class TestFcHdfsSymlink extends F
@Test
/** Access a file using a link that spans Hdfs to LocalFs */
public void testLinkAcrossFileSystems() throws IOException {
- Path localDir = new Path("file://"+getAbsoluteTestRootDir(fc)+"/test");
- Path localFile = new Path("file://"+getAbsoluteTestRootDir(fc)+"/test/file");
- Path link = new Path(testBaseDir1(), "linkToFile");
FileContext localFc = FileContext.getLocalFSFileContext();
+ Path localDir = new Path("file://"+fileContextTestHelper.getAbsoluteTestRootDir(localFc)+"/test");
+ Path localFile = new Path("file://"+fileContextTestHelper.getAbsoluteTestRootDir(localFc)+"/test/file");
+ Path link = new Path(testBaseDir1(), "linkToFile");
localFc.delete(localDir, true);
localFc.mkdir(localDir, FileContext.DEFAULT_PERM, true);
localFc.setWorkingDirectory(localDir);
@@ -120,12 +119,12 @@ public class TestFcHdfsSymlink extends F
@Test
/** Test renaming a file across two file systems using a link */
public void testRenameAcrossFileSystemsViaLink() throws IOException {
- Path localDir = new Path("file://"+getAbsoluteTestRootDir(fc)+"/test");
+ FileContext localFc = FileContext.getLocalFSFileContext();
+ Path localDir = new Path("file://"+fileContextTestHelper.getAbsoluteTestRootDir(localFc)+"/test");
Path hdfsFile = new Path(testBaseDir1(), "file");
Path link = new Path(testBaseDir1(), "link");
Path hdfsFileNew = new Path(testBaseDir1(), "fileNew");
Path hdfsFileNewViaLink = new Path(link, "fileNew");
- FileContext localFc = FileContext.getLocalFSFileContext();
localFc.delete(localDir, true);
localFc.mkdir(localDir, FileContext.DEFAULT_PERM, true);
localFc.setWorkingDirectory(localDir);
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestHDFSFileContextMainOperations.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestHDFSFileContextMainOperations.java?rev=1489250&r1=1489249&r2=1489250&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestHDFSFileContextMainOperations.java (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/TestHDFSFileContextMainOperations.java Tue Jun 4 00:29:37 2013
@@ -19,7 +19,6 @@
package org.apache.hadoop.fs;
import static org.apache.hadoop.fs.FileContextTestHelper.exists;
-import static org.apache.hadoop.fs.FileContextTestHelper.getTestRootPath;
import java.io.IOException;
import java.net.URISyntaxException;
@@ -42,6 +41,7 @@ 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();
@@ -101,6 +101,10 @@ public class TestHDFSFileContextMainOper
return e;
}
+ private Path getTestRootPath(FileContext fc, String path) {
+ return fileContextTestHelper.getTestRootPath(fc, path);
+ }
+
@Test
public void testOldRenameWithQuota() throws Exception {
DistributedFileSystem fs = (DistributedFileSystem) cluster.getFileSystem();
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemAtHdfsRoot.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemAtHdfsRoot.java?rev=1489250&r1=1489249&r2=1489250&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemAtHdfsRoot.java (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemAtHdfsRoot.java Tue Jun 4 00:29:37 2013
@@ -25,6 +25,7 @@ import javax.security.auth.login.LoginEx
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.FileSystemTestHelper;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.MiniDFSCluster;
@@ -42,6 +43,11 @@ public class TestViewFileSystemAtHdfsRoo
private static Configuration CONF = new Configuration();
private static FileSystem fHdfs;
+ @Override
+ protected FileSystemTestHelper createFileSystemHelper() {
+ return new FileSystemTestHelper("/tmp/TestViewFileSystemAtHdfsRoot");
+ }
+
@BeforeClass
public static void clusterSetupAtBegining() throws IOException,
LoginException, URISyntaxException {
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemHdfs.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemHdfs.java?rev=1489250&r1=1489249&r2=1489250&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemHdfs.java (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFileSystemHdfs.java Tue Jun 4 00:29:37 2013
@@ -48,6 +48,11 @@ public class TestViewFileSystemHdfs exte
private FileSystem fsTarget2;
Path targetTestRoot2;
+ @Override
+ protected FileSystemTestHelper createFileSystemHelper() {
+ return new FileSystemTestHelper("/tmp/TestViewFileSystemHdfs");
+ }
+
@BeforeClass
public static void clusterSetupAtBegining() throws IOException,
LoginException, URISyntaxException {
@@ -86,7 +91,7 @@ public class TestViewFileSystemHdfs exte
// create the test root on local_fs
fsTarget = fHdfs;
fsTarget2 = fHdfs2;
- targetTestRoot2 = FileSystemTestHelper.getAbsoluteTestRootPath(fsTarget2);
+ targetTestRoot2 = new FileSystemTestHelper().getAbsoluteTestRootPath(fsTarget2);
super.setUp();
}
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsFileStatusHdfs.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsFileStatusHdfs.java?rev=1489250&r1=1489249&r2=1489250&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsFileStatusHdfs.java (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsFileStatusHdfs.java Tue Jun 4 00:29:37 2013
@@ -52,6 +52,7 @@ public class TestViewFsFileStatusHdfs {
static final String testfilename = "/tmp/testFileStatusSerialziation";
static final String someFile = "/hdfstmp/someFileForTestGetFileChecksum";
+ private static final FileSystemTestHelper fileSystemTestHelper = new FileSystemTestHelper();
private static MiniDFSCluster cluster;
private static Path defaultWorkingDirectory;
private static Configuration CONF = new Configuration();
@@ -79,7 +80,7 @@ public class TestViewFsFileStatusHdfs {
@Test
public void testFileStatusSerialziation()
throws IOException, URISyntaxException {
- long len = FileSystemTestHelper.createFile(fHdfs, testfilename);
+ long len = fileSystemTestHelper.createFile(fHdfs, testfilename);
FileStatus stat = vfs.getFileStatus(new Path(testfilename));
assertEquals(len, stat.getLen());
// check serialization/deserialization
@@ -95,8 +96,8 @@ public class TestViewFsFileStatusHdfs {
@Test
public void testGetFileChecksum() throws IOException, URISyntaxException {
// Create two different files in HDFS
- FileSystemTestHelper.createFile(fHdfs, someFile);
- FileSystemTestHelper.createFile(fHdfs, FileSystemTestHelper
+ fileSystemTestHelper.createFile(fHdfs, someFile);
+ fileSystemTestHelper.createFile(fHdfs, fileSystemTestHelper
.getTestRootPath(fHdfs, someFile + "other"), 1, 512);
// Get checksum through ViewFS
FileChecksum viewFSCheckSum = vfs.getFileChecksum(
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestFSMainOperationsWebHdfs.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestFSMainOperationsWebHdfs.java?rev=1489250&r1=1489249&r2=1489250&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestFSMainOperationsWebHdfs.java (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/web/TestFSMainOperationsWebHdfs.java Tue Jun 4 00:29:37 2013
@@ -17,9 +17,6 @@
*/
package org.apache.hadoop.hdfs.web;
-import static org.apache.hadoop.fs.FileSystemTestHelper.exists;
-import static org.apache.hadoop.fs.FileSystemTestHelper.getTestRootPath;
-
import java.io.IOException;
import java.net.URI;
import java.security.PrivilegedExceptionAction;
@@ -52,6 +49,12 @@ public class TestFSMainOperationsWebHdfs
private static MiniDFSCluster cluster = null;
private static Path defaultWorkingDirectory;
+ private static FileSystem fileSystem;
+
+ @Override
+ protected FileSystem createFileSystem() throws Exception {
+ return fileSystem;
+ }
@BeforeClass
public static void setupCluster() {
@@ -73,14 +76,14 @@ public class TestFSMainOperationsWebHdfs
final UserGroupInformation current = UserGroupInformation.getCurrentUser();
final UserGroupInformation ugi = UserGroupInformation.createUserForTesting(
current.getShortUserName() + "x", new String[]{"user"});
- fSys = ugi.doAs(new PrivilegedExceptionAction<FileSystem>() {
+ fileSystem = ugi.doAs(new PrivilegedExceptionAction<FileSystem>() {
@Override
public FileSystem run() throws Exception {
return FileSystem.get(new URI(uri), conf);
}
});
- defaultWorkingDirectory = fSys.getWorkingDirectory();
+ defaultWorkingDirectory = fileSystem.getWorkingDirectory();
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -159,4 +162,4 @@ public class TestFSMainOperationsWebHdfs
// also okay for HDFS.
}
}
-}
\ No newline at end of file
+}