浏览代码

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