From 172d07825c138e021b0fb40f768e1da8c91914e3 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Thu, 7 Jan 2016 15:03:59 +0000 Subject: [PATCH] HADOOP-12613. TestFind.processArguments occasionally fails. (Wei-Chiu Chuang via stevel) --- .../hadoop-common/CHANGES.txt | 3 ++ .../apache/hadoop/fs/shell/find/TestFind.java | 53 ++++++++++--------- 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index b83b652fe0..d27f2573da 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -668,6 +668,9 @@ Release 2.9.0 - UNRELEASED HADOOP-12655. TestHttpServer.testBindAddress bind port range is wider than expected. (Wei-Chiu Chuang via stevel) + HADOOP-12613. TestFind.processArguments occasionally fails. + (Wei-Chiu Chuang via stevel) + Release 2.8.0 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/find/TestFind.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/find/TestFind.java index 7d794204bf..8bfcec6614 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/find/TestFind.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/find/TestFind.java @@ -38,10 +38,15 @@ import org.apache.hadoop.fs.shell.find.FindOptions; import org.apache.hadoop.fs.shell.find.Result; import org.junit.Before; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.Timeout; import org.mockito.InOrder; public class TestFind { + @Rule + public Timeout timeout = new Timeout(10000); + private static FileSystem mockFs; private static Configuration conf; @@ -52,7 +57,7 @@ public void setup() throws IOException { } // check follow link option is recognized - @Test(timeout = 1000) + @Test public void processOptionsFollowLink() throws IOException { Find find = new Find(); String args = "-L path"; @@ -62,7 +67,7 @@ public void processOptionsFollowLink() throws IOException { } // check follow arg link option is recognized - @Test(timeout = 1000) + @Test public void processOptionsFollowArgLink() throws IOException { Find find = new Find(); String args = "-H path"; @@ -72,7 +77,7 @@ public void processOptionsFollowArgLink() throws IOException { } // check follow arg link option is recognized - @Test(timeout = 1000) + @Test public void processOptionsFollowLinkFollowArgLink() throws IOException { Find find = new Find(); String args = "-L -H path"; @@ -84,7 +89,7 @@ public void processOptionsFollowLinkFollowArgLink() throws IOException { } // check options and expressions are stripped from args leaving paths - @Test(timeout = 1000) + @Test public void processOptionsExpression() throws IOException { Find find = new Find(); find.setConf(conf); @@ -98,7 +103,7 @@ public void processOptionsExpression() throws IOException { } // check print is used as the default expression - @Test(timeout = 1000) + @Test public void processOptionsNoExpression() throws IOException { Find find = new Find(); find.setConf(conf); @@ -110,7 +115,7 @@ public void processOptionsNoExpression() throws IOException { } // check unknown options are rejected - @Test(timeout = 1000) + @Test public void processOptionsUnknown() throws IOException { Find find = new Find(); find.setConf(conf); @@ -123,7 +128,7 @@ public void processOptionsUnknown() throws IOException { } // check unknown options are rejected when mixed with known options - @Test(timeout = 1000) + @Test public void processOptionsKnownUnknown() throws IOException { Find find = new Find(); find.setConf(conf); @@ -136,7 +141,7 @@ public void processOptionsKnownUnknown() throws IOException { } // check no path defaults to current working directory - @Test(timeout = 1000) + @Test public void processOptionsNoPath() throws IOException { Find find = new Find(); find.setConf(conf); @@ -148,7 +153,7 @@ public void processOptionsNoPath() throws IOException { } // check -name is handled correctly - @Test(timeout = 1000) + @Test public void processOptionsName() throws IOException { Find find = new Find(); find.setConf(conf); @@ -160,7 +165,7 @@ public void processOptionsName() throws IOException { } // check -iname is handled correctly - @Test(timeout = 1000) + @Test public void processOptionsIname() throws IOException { Find find = new Find(); find.setConf(conf); @@ -172,7 +177,7 @@ public void processOptionsIname() throws IOException { } // check -print is handled correctly - @Test(timeout = 1000) + @Test public void processOptionsPrint() throws IOException { Find find = new Find(); find.setConf(conf); @@ -184,7 +189,7 @@ public void processOptionsPrint() throws IOException { } // check -print0 is handled correctly - @Test(timeout = 1000) + @Test public void processOptionsPrint0() throws IOException { Find find = new Find(); find.setConf(conf); @@ -196,7 +201,7 @@ public void processOptionsPrint0() throws IOException { } // check an implicit and is handled correctly - @Test(timeout = 1000) + @Test public void processOptionsNoop() throws IOException { Find find = new Find(); find.setConf(conf); @@ -209,7 +214,7 @@ public void processOptionsNoop() throws IOException { } // check -a is handled correctly - @Test(timeout = 1000) + @Test public void processOptionsA() throws IOException { Find find = new Find(); find.setConf(conf); @@ -222,7 +227,7 @@ public void processOptionsA() throws IOException { } // check -and is handled correctly - @Test(timeout = 1000) + @Test public void processOptionsAnd() throws IOException { Find find = new Find(); find.setConf(conf); @@ -235,7 +240,7 @@ public void processOptionsAnd() throws IOException { } // check expressions are called in the correct order - @Test(timeout = 1000) + @Test public void processArguments() throws IOException { LinkedList items = createDirectories(); @@ -294,7 +299,7 @@ public void processArguments() throws IOException { } // check that directories are descended correctly when -depth is specified - @Test(timeout = 1000) + @Test public void processArgumentsDepthFirst() throws IOException { LinkedList items = createDirectories(); @@ -355,7 +360,7 @@ public void processArgumentsDepthFirst() throws IOException { // check symlinks given as path arguments are processed correctly with the // follow arg option set - @Test(timeout = 1000) + @Test public void processArgumentsOptionFollowArg() throws IOException { LinkedList items = createDirectories(); @@ -415,7 +420,7 @@ public void processArgumentsOptionFollowArg() throws IOException { // check symlinks given as path arguments are processed correctly with the // follow option - @Test(timeout = 1000) + @Test public void processArgumentsOptionFollow() throws IOException { LinkedList items = createDirectories(); @@ -478,7 +483,7 @@ public void processArgumentsOptionFollow() throws IOException { } // check minimum depth is handledfollowLink - @Test(timeout = 1000) + @Test public void processArgumentsMinDepth() throws IOException { LinkedList items = createDirectories(); @@ -528,7 +533,7 @@ public void processArgumentsMinDepth() throws IOException { } // check maximum depth is handled - @Test(timeout = 1000) + @Test public void processArgumentsMaxDepth() throws IOException { LinkedList items = createDirectories(); @@ -584,7 +589,7 @@ public void processArgumentsMaxDepth() throws IOException { } // check min depth is handled when -depth is specified - @Test(timeout = 1000) + @Test public void processArgumentsDepthFirstMinDepth() throws IOException { LinkedList items = createDirectories(); @@ -635,7 +640,7 @@ public void processArgumentsDepthFirstMinDepth() throws IOException { } // check max depth is handled when -depth is specified - @Test(timeout = 1000) + @Test public void processArgumentsDepthFirstMaxDepth() throws IOException { LinkedList items = createDirectories(); @@ -692,7 +697,7 @@ public void processArgumentsDepthFirstMaxDepth() throws IOException { } // check expressions are called in the correct order - @Test(timeout = 1000) + @Test public void processArgumentsNoDescend() throws IOException { LinkedList items = createDirectories();