Repository: crunch Updated Branches: refs/heads/master f47347814 -> ae0221f34
CRUNCH-652: Fix to make the SourceTargetHelperTest less flakey on hadoop 3.0.0. Contributed by Gergo Repas. Project: http://git-wip-us.apache.org/repos/asf/crunch/repo Commit: http://git-wip-us.apache.org/repos/asf/crunch/commit/ae0221f3 Tree: http://git-wip-us.apache.org/repos/asf/crunch/tree/ae0221f3 Diff: http://git-wip-us.apache.org/repos/asf/crunch/diff/ae0221f3 Branch: refs/heads/master Commit: ae0221f34cd03ee988d20c986932af762493f2cb Parents: f473478 Author: Josh Wills <[email protected]> Authored: Thu Oct 26 21:09:27 2017 -0700 Committer: Josh Wills <[email protected]> Committed: Thu Oct 26 21:09:31 2017 -0700 ---------------------------------------------------------------------- .../org/apache/crunch/io/SourceTargetHelperTest.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/crunch/blob/ae0221f3/crunch-core/src/test/java/org/apache/crunch/io/SourceTargetHelperTest.java ---------------------------------------------------------------------- diff --git a/crunch-core/src/test/java/org/apache/crunch/io/SourceTargetHelperTest.java b/crunch-core/src/test/java/org/apache/crunch/io/SourceTargetHelperTest.java index 5b0ea55..434fd10 100644 --- a/crunch-core/src/test/java/org/apache/crunch/io/SourceTargetHelperTest.java +++ b/crunch-core/src/test/java/org/apache/crunch/io/SourceTargetHelperTest.java @@ -27,6 +27,7 @@ import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.LocalFileSystem; import org.apache.hadoop.fs.Path; +import org.apache.hadoop.fs.RawLocalFileSystem; import org.junit.Test; public class SourceTargetHelperTest { @@ -36,7 +37,7 @@ public class SourceTargetHelperTest { File tmp = File.createTempFile("pathsize", ""); Path tmpPath = new Path(tmp.getAbsolutePath()); tmp.delete(); - FileSystem fs = FileSystem.getLocal(new Configuration()); + FileSystem fs = FileSystem.getLocal(new Configuration(false)); assertEquals(-1L, SourceTargetHelper.getPathSize(fs, tmpPath)); } @@ -49,7 +50,17 @@ public class SourceTargetHelperTest { /** * Mock FileSystem that returns null for {@link FileSystem#listStatus(Path)}. */ - static class MockFileSystem extends LocalFileSystem { + private static class MockFileSystem extends LocalFileSystem { + + private static RawLocalFileSystem createConfiguredRawLocalFileSystem() { + RawLocalFileSystem fs = new RawLocalFileSystem(); + fs.setConf(new Configuration(false)); + return fs; + } + + private MockFileSystem() { + super(createConfiguredRawLocalFileSystem()); + } @Override public FileStatus[] listStatus(Path f) throws IOException {
