Browse Source

Merge -r 628998:628999 from trunk to branch-0.16 to fix HADOOP-2813.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.16@635123 13f79535-47bb-0310-9956-ffa450edef68
Nigel Daley 17 years ago
parent
commit
c8e9e4cf8e
2 changed files with 8 additions and 1 deletions
  1. 3 0
      CHANGES.txt
  2. 5 1
      src/test/org/apache/hadoop/fs/TestDU.java

+ 3 - 0
CHANGES.txt

@@ -135,6 +135,9 @@ Release 0.16.1 - 2008-03-13
     HADOOP-2915. Fixed FileSystem.CACHE so that a username is included
     in the cache key. (Tsz Wo (Nicholas), SZE via nigel)
 
+    HADOOP-2813. TestDU unit test uses its own directory to run its
+    sequence of tests.  (Mahadev Konar via dhruba)
+
 Release 0.16.0 - 2008-02-07
 
   INCOMPATIBLE CHANGES

+ 5 - 1
src/test/org/apache/hadoop/fs/TestDU.java

@@ -25,7 +25,8 @@ import junit.framework.TestCase;
 
 /** This test makes sure that "DU" does not get to run on each call to getUsed */ 
 public class TestDU extends TestCase {
-  final static private File DU_DIR = new File(".");
+  final static private File DU_DIR = new File(
+      System.getProperty("test.build.data","/tmp"), "dutmp");
   final static private File DU_FILE1 = new File(DU_DIR, "tmp1");
   final static private File DU_FILE2 = new File(DU_DIR, "tmp2");
   
@@ -50,6 +51,8 @@ public class TestDU extends TestCase {
   private void testDU(long interval) throws IOException {
     rmFile(DU_FILE1);
     rmFile(DU_FILE2);
+    DU_DIR.delete();
+    assertTrue(DU_DIR.mkdirs());
     try {
       createFile(DU_FILE1);
       DU du = new DU(DU_DIR, interval*60000);
@@ -64,6 +67,7 @@ public class TestDU extends TestCase {
     } finally {
       rmFile(DU_FILE1);
       rmFile(DU_FILE2);
+      DU_DIR.delete();
     }
   }