فهرست منبع

HADOOP-3726. Throw exceptions from TestCLI setup and teardown instead of
swallowing them. Contributed by Steve Loughran.


git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/trunk@675708 13f79535-47bb-0310-9956-ffa450edef68

Christopher Douglas 17 سال پیش
والد
کامیت
75e5b002ae
2فایلهای تغییر یافته به همراه23 افزوده شده و 28 حذف شده
  1. 3 0
      CHANGES.txt
  2. 20 28
      src/test/org/apache/hadoop/cli/TestCLI.java

+ 3 - 0
CHANGES.txt

@@ -93,6 +93,9 @@ Trunk (unreleased changes)
     HADOOP-3725. Prevent TestMiniMRMapDebugScript from swallowing exceptions.
     (Steve Loughran via cdouglas)
 
+    HADOOP-3726. Throw exceptions from TestCLI setup and teardown instead of
+    swallowing them. (Steve Loughran via cdouglas)
+
 Release 0.18.0 - Unreleased
 
   INCOMPATIBLE CHANGES

+ 20 - 28
src/test/org/apache/hadoop/cli/TestCLI.java

@@ -104,46 +104,38 @@ public class TestCLI extends TestCase {
   /*
    * Setup
    */
-  public void setUp() {
+  public void setUp() throws Exception {
     // Read the testConfig.xml file
     readTestConfigFile();
     
     // Start up the mini dfs cluster
     boolean success = false;
-    try {
-      conf = new Configuration();
-      cluster = new MiniDFSCluster(conf, 1, true, null);
-      namenode = conf.get("fs.default.name", "file:///");
-      clitestDataDir = new File(System.getProperty("test.cache.data")).
-        toURI().toString().replace(' ', '+');
-      username = System.getProperty("user.name");
-      
-      FileSystem fs = cluster.getFileSystem();
-      assertTrue("Not a HDFS: "+fs.getUri(),
-                 fs instanceof DistributedFileSystem);
-      dfs = (DistributedFileSystem) fs;
-      success = true;
-    } catch (Exception e) {
-      LOG.info("Exception starting MiniDFS cluster: " + e);
-    }
-    
+    conf = new Configuration();
+    cluster = new MiniDFSCluster(conf, 1, true, null);
+    namenode = conf.get("fs.default.name", "file:///");
+    clitestDataDir = new File(System.getProperty("test.cache.data")).
+      toURI().toString().replace(' ', '+');
+    username = System.getProperty("user.name");
+
+    FileSystem fs = cluster.getFileSystem();
+    assertTrue("Not a HDFS: "+fs.getUri(),
+               fs instanceof DistributedFileSystem);
+    dfs = (DistributedFileSystem) fs;
+    success = true;
+
     assertTrue("Error setting up Mini DFS cluster", success);
   }
   
   /**
    * Tear down
    */
-  public void tearDown() {
+  public void tearDown() throws Exception {
     boolean success = false;
-    try {
-      dfs.close();
-      cluster.shutdown();
-      success = true;
-      Thread.sleep(2000);
-    } catch (Exception e) {
-      LOG.info("Exception shutting down MiniDFS cluster: " + e);
-    }
-    
+    dfs.close();
+    cluster.shutdown();
+    success = true;
+    Thread.sleep(2000);
+
     assertTrue("Error tearing down Mini DFS cluster", success);
     
     displayResults();