فهرست منبع

HADOOP-533. Fix unit test to not modify conf/ directory. Contributed by Hairong.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@447560 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 19 سال پیش
والد
کامیت
8228b4024b
2فایلهای تغییر یافته به همراه8 افزوده شده و 5 حذف شده
  1. 3 0
      CHANGES.txt
  2. 5 5
      src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java

+ 3 - 0
CHANGES.txt

@@ -17,6 +17,9 @@ Trunk (unreleased changes)
 4. HADOOP-288.  Add a file caching system and use it in MapReduce to
    cache job jar files on slave nodes.  (Mahadev Konar via cutting)
 
+5. HADOOP-533.  Fix unit test to not modify conf directory.
+  (Hairong Kuang via cutting)
+
 
 Release 0.6.2 (unreleased)
 

+ 5 - 5
src/test/org/apache/hadoop/dfs/TestDFSShellGenericOptions.java

@@ -43,7 +43,7 @@ public class TestDFSShellGenericOptions extends TestCase {
     
     private void testConfOption(String[] args, String namenode) {
         // prepare configuration hadoop-site.xml
-        File configDir = new File("conf", "minidfs");
+        File configDir = new File(new File("build", "test"), "minidfs");
         configDir.mkdirs();
         File siteFile = new File(configDir, "hadoop-site.xml");
         PrintWriter pw;
@@ -61,14 +61,14 @@ public class TestDFSShellGenericOptions extends TestCase {
     
             // prepare arguments to create a directory /data
             args[0] = "-conf";
-            args[1] = "conf/minidfs/hadoop-site.xml";
+            args[1] = siteFile.getPath();
             execute(args, namenode); 
         } catch (FileNotFoundException e) {
-            // TODO Auto-generated catch block
             e.printStackTrace();
+        } finally {
+          siteFile.delete();
+          configDir.delete();
         }
-        
-        configDir.delete();
     }
     
     private void testPropertyOption(String[] args, String namenode) {