HADOOP-9638. Parallel test changes caused invalid test path for several HDFS tests on Windows. Contributed by Andrey Klochkov.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1492297 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Chris Nauroth 2013-06-12 17:21:47 +00:00
parent b90755c296
commit c5821cf38b
12 changed files with 58 additions and 8 deletions

View File

@ -582,6 +582,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)
BREAKDOWN OF HADOOP-8562 SUBTASKS AND RELATED JIRAS
HADOOP-8924. Hadoop Common creating package-info.java must not depend on

View File

@ -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() {

View File

@ -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() {

View File

@ -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 {

View File

@ -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 {

View File

@ -24,7 +24,6 @@ import java.net.URISyntaxException;
import javax.security.auth.login.LoginException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.hdfs.HdfsConfiguration;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.security.UserGroupInformation;
@ -35,7 +34,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;

View File

@ -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;

View File

@ -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;

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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;