HADOOP-13148. TestDistCpViewFs to include IOExceptions in test error reports. 
Contributed by Steve Loughran.

(cherry picked from commit b9685e85d59e69e5dd64802fa9025dad1b315be5)
(cherry picked from commit bb41547fb42b9dd2b80ec2a7286db6d35fd251b5)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/28a2f28e
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/28a2f28e
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/28a2f28e

Branch: refs/heads/branch-2.8
Commit: 28a2f28e422247f7595fc49dc2c0913646006dec
Parents: 70faa87
Author: Chris Nauroth <cnaur...@apache.org>
Authored: Mon May 16 11:53:17 2016 -0700
Committer: Chris Nauroth <cnaur...@apache.org>
Committed: Mon May 16 11:53:33 2016 -0700

----------------------------------------------------------------------
 .../apache/hadoop/tools/TestDistCpViewFs.java   | 93 +++++---------------
 1 file changed, 22 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/28a2f28e/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestDistCpViewFs.java
----------------------------------------------------------------------
diff --git 
a/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestDistCpViewFs.java
 
b/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestDistCpViewFs.java
index a6939a2..5511e09 100644
--- 
a/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestDistCpViewFs.java
+++ 
b/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/TestDistCpViewFs.java
@@ -73,13 +73,12 @@ public class TestDistCpViewFs {
   }
 
   @Test
-  public void testSingleFileMissingTarget() {
+  public void testSingleFileMissingTarget() throws IOException {
     caseSingleFileMissingTarget(false);
     caseSingleFileMissingTarget(true);
   }
 
-
-  private void caseSingleFileMissingTarget(boolean sync) {
+  private void caseSingleFileMissingTarget(boolean sync) throws IOException{
 
     try {
       addEntries(listFile, "singlefile1/file1");
@@ -88,21 +87,18 @@ public class TestDistCpViewFs {
       runTest(listFile, target, false, sync);
 
       checkResult(target, 1);
-    } catch (IOException e) {
-      LOG.error("Exception encountered while testing distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
     }
   }
 
   @Test
-  public void testSingleFileTargetFile() {
+  public void testSingleFileTargetFile() throws IOException{
     caseSingleFileTargetFile(false);
     caseSingleFileTargetFile(true);
   }
 
-  private void caseSingleFileTargetFile(boolean sync) {
+  private void caseSingleFileTargetFile(boolean sync) throws IOException {
 
     try {
       addEntries(listFile, "singlefile1/file1");
@@ -111,21 +107,18 @@ public class TestDistCpViewFs {
       runTest(listFile, target, false, sync);
 
       checkResult(target, 1);
-    } catch (IOException e) {
-      LOG.error("Exception encountered while testing distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
     }
   }
 
   @Test
-  public void testSingleFileTargetDir() {
+  public void testSingleFileTargetDir() throws IOException {
     caseSingleFileTargetDir(false);
     caseSingleFileTargetDir(true);
   }
 
-  private void caseSingleFileTargetDir(boolean sync) {
+  private void caseSingleFileTargetDir(boolean sync) throws IOException {
 
     try {
       addEntries(listFile, "singlefile2/file2");
@@ -135,21 +128,18 @@ public class TestDistCpViewFs {
       runTest(listFile, target, true, sync);
 
       checkResult(target, 1, "file2");
-    } catch (IOException e) {
-      LOG.error("Exception encountered while testing distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
     }
   }
 
   @Test
-  public void testSingleDirTargetMissing() {
+  public void testSingleDirTargetMissing() throws IOException{
     caseSingleDirTargetMissing(false);
     caseSingleDirTargetMissing(true);
   }
 
-  private void caseSingleDirTargetMissing(boolean sync) {
+  private void caseSingleDirTargetMissing(boolean sync) throws IOException {
 
     try {
       addEntries(listFile, "singledir");
@@ -158,16 +148,13 @@ public class TestDistCpViewFs {
       runTest(listFile, target, false, sync);
 
       checkResult(target, 1, "dir1");
-    } catch (IOException e) {
-      LOG.error("Exception encountered while testing distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
     }
   }
 
   @Test
-  public void testSingleDirTargetPresent() {
+  public void testSingleDirTargetPresent() throws IOException{
 
     try {
       addEntries(listFile, "singledir");
@@ -177,16 +164,13 @@ public class TestDistCpViewFs {
       runTest(listFile, target, true, false);
 
       checkResult(target, 1, "singledir/dir1");
-    } catch (IOException e) {
-      LOG.error("Exception encountered while testing distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
     }
   }
 
   @Test
-  public void testUpdateSingleDirTargetPresent() {
+  public void testUpdateSingleDirTargetPresent() throws IOException {
 
     try {
       addEntries(listFile, "Usingledir");
@@ -196,21 +180,18 @@ public class TestDistCpViewFs {
       runTest(listFile, target, true, true);
 
       checkResult(target, 1, "Udir1");
-    } catch (IOException e) {
-      LOG.error("Exception encountered while testing distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
     }
   }
 
   @Test
-  public void testMultiFileTargetPresent() {
+  public void testMultiFileTargetPresent() throws IOException {
     caseMultiFileTargetPresent(false);
     caseMultiFileTargetPresent(true);
   }
 
-  private void caseMultiFileTargetPresent(boolean sync) {
+  private void caseMultiFileTargetPresent(boolean sync) throws IOException {
 
     try {
       addEntries(listFile, "multifile/file3", "multifile/file4", 
"multifile/file5");
@@ -220,21 +201,18 @@ public class TestDistCpViewFs {
       runTest(listFile, target, true, sync);
 
       checkResult(target, 3, "file3", "file4", "file5");
-    } catch (IOException e) {
-      LOG.error("Exception encountered while testing distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
     }
   }
 
   @Test
-  public void testMultiFileTargetMissing() {
+  public void testMultiFileTargetMissing() throws IOException {
     caseMultiFileTargetMissing(false);
     caseMultiFileTargetMissing(true);
   }
 
-  private void caseMultiFileTargetMissing(boolean sync) {
+  private void caseMultiFileTargetMissing(boolean sync) throws IOException {
 
     try {
       addEntries(listFile, "multifile/file3", "multifile/file4", 
"multifile/file5");
@@ -243,16 +221,13 @@ public class TestDistCpViewFs {
       runTest(listFile, target, false, sync);
 
       checkResult(target, 3, "file3", "file4", "file5");
-    } catch (IOException e) {
-      LOG.error("Exception encountered while testing distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
     }
   }
 
   @Test
-  public void testMultiDirTargetPresent() {
+  public void testMultiDirTargetPresent() throws IOException {
 
     try {
       addEntries(listFile, "multifile", "singledir");
@@ -262,16 +237,13 @@ public class TestDistCpViewFs {
       runTest(listFile, target, true, false);
 
       checkResult(target, 2, "multifile/file3", "multifile/file4", 
"multifile/file5", "singledir/dir1");
-    } catch (IOException e) {
-      LOG.error("Exception encountered while testing distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
     }
   }
 
   @Test
-  public void testUpdateMultiDirTargetPresent() {
+  public void testUpdateMultiDirTargetPresent() throws IOException {
 
     try {
       addEntries(listFile, "Umultifile", "Usingledir");
@@ -281,16 +253,13 @@ public class TestDistCpViewFs {
       runTest(listFile, target, true, true);
 
       checkResult(target, 4, "Ufile3", "Ufile4", "Ufile5", "Udir1");
-    } catch (IOException e) {
-      LOG.error("Exception encountered while testing distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
     }
   }
 
   @Test
-  public void testMultiDirTargetMissing() {
+  public void testMultiDirTargetMissing() throws IOException {
 
     try {
       addEntries(listFile, "multifile", "singledir");
@@ -301,16 +270,13 @@ public class TestDistCpViewFs {
 
       checkResult(target, 2, "multifile/file3", "multifile/file4",
           "multifile/file5", "singledir/dir1");
-    } catch (IOException e) {
-      LOG.error("Exception encountered while testing distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
     }
   }
 
   @Test
-  public void testUpdateMultiDirTargetMissing() {
+  public void testUpdateMultiDirTargetMissing() throws IOException {
 
     try {
       addEntries(listFile, "multifile", "singledir");
@@ -320,16 +286,13 @@ public class TestDistCpViewFs {
       runTest(listFile, target, false, true);
 
       checkResult(target, 4, "file3", "file4", "file5", "dir1");
-    } catch (IOException e) {
-      LOG.error("Exception encountered while testing distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
     }
   }
 
   @Test
-  public void testGlobTargetMissingSingleLevel() {
+  public void testGlobTargetMissingSingleLevel() throws IOException {
 
     try {
       Path listFile = new 
Path("target/tmp1/listing").makeQualified(fs.getUri(),
@@ -342,9 +305,6 @@ public class TestDistCpViewFs {
 
       checkResult(target, 2, "multifile/file3", "multifile/file4", 
"multifile/file5",
           "singledir/dir2/file6");
-    } catch (IOException e) {
-      LOG.error("Exception encountered while testing distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
       TestDistCpUtils.delete(fs, "target/tmp1");
@@ -352,7 +312,7 @@ public class TestDistCpViewFs {
   }
 
   @Test
-  public void testUpdateGlobTargetMissingSingleLevel() {
+  public void testUpdateGlobTargetMissingSingleLevel() throws IOException {
 
     try {
       Path listFile = new 
Path("target/tmp1/listing").makeQualified(fs.getUri(),
@@ -364,9 +324,6 @@ public class TestDistCpViewFs {
       runTest(listFile, target, false, true);
 
       checkResult(target, 4, "file3", "file4", "file5", "dir2/file6");
-    } catch (IOException e) {
-      LOG.error("Exception encountered while running distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
       TestDistCpUtils.delete(fs, "target/tmp1");
@@ -374,7 +331,7 @@ public class TestDistCpViewFs {
   }
 
   @Test
-  public void testGlobTargetMissingMultiLevel() {
+  public void testGlobTargetMissingMultiLevel() throws IOException {
 
     try {
       Path listFile = new 
Path("target/tmp1/listing").makeQualified(fs.getUri(),
@@ -388,9 +345,6 @@ public class TestDistCpViewFs {
 
       checkResult(target, 4, "file3", "file4", "file5",
           "dir3/file7", "dir3/file8", "dir3/file9");
-    } catch (IOException e) {
-      LOG.error("Exception encountered while running distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
       TestDistCpUtils.delete(fs, "target/tmp1");
@@ -398,7 +352,7 @@ public class TestDistCpViewFs {
   }
 
   @Test
-  public void testUpdateGlobTargetMissingMultiLevel() {
+  public void testUpdateGlobTargetMissingMultiLevel() throws IOException {
 
     try {
       Path listFile = new 
Path("target/tmp1/listing").makeQualified(fs.getUri(),
@@ -412,9 +366,6 @@ public class TestDistCpViewFs {
 
       checkResult(target, 6, "file3", "file4", "file5",
           "file7", "file8", "file9");
-    } catch (IOException e) {
-      LOG.error("Exception encountered while running distcp", e);
-      Assert.fail("distcp failure");
     } finally {
       TestDistCpUtils.delete(fs, root);
       TestDistCpUtils.delete(fs, "target/tmp1");


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to