Author: omalley
Date: Mon Jul 18 21:58:54 2011
New Revision: 1148069

URL: http://svn.apache.org/viewvc?rev=1148069&view=rev
Log:
HADOOP-7045. TestDU fails on systems with local file systems with 
extended attributes. (eli)

Modified:
    hadoop/common/branches/branch-0.20-security-204/CHANGES.txt
    
hadoop/common/branches/branch-0.20-security-204/src/test/org/apache/hadoop/fs/TestDU.java

Modified: hadoop/common/branches/branch-0.20-security-204/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-204/CHANGES.txt?rev=1148069&r1=1148068&r2=1148069&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-204/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.20-security-204/CHANGES.txt Mon Jul 18 
21:58:54 2011
@@ -13,6 +13,9 @@ Release 0.20.204.0 - unreleased
 
   BUG FIXES
 
+    HADOOP-7045. TestDU fails on systems with local file systems with 
+    extended attributes. (eli)
+
     MAPREDUCE-2495. exit() the TaskTracker when the distributed cache cleanup
     thread dies. (Robert Joseph Evans via cdouglas)
 

Modified: 
hadoop/common/branches/branch-0.20-security-204/src/test/org/apache/hadoop/fs/TestDU.java
URL: 
http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-204/src/test/org/apache/hadoop/fs/TestDU.java?rev=1148069&r1=1148068&r2=1148069&view=diff
==============================================================================
--- 
hadoop/common/branches/branch-0.20-security-204/src/test/org/apache/hadoop/fs/TestDU.java
 (original)
+++ 
hadoop/common/branches/branch-0.20-security-204/src/test/org/apache/hadoop/fs/TestDU.java
 Mon Jul 18 21:58:54 2011
@@ -65,7 +65,10 @@ public class TestDU extends TestCase {
    * @throws InterruptedException
    */
   public void testDU() throws IOException, InterruptedException {
-    int writtenSize = 32*1024;   // writing 32K
+    final int writtenSize = 32*1024;   // writing 32K
+    // Allow for extra 4K on-disk slack for local file systems
+    // that may store additional file metadata (eg ext attrs).
+    final int slack = 4*1024;
     File file = new File(DU_DIR, "data");
     createFile(file, writtenSize);
 
@@ -76,7 +79,9 @@ public class TestDU extends TestCase {
     long duSize = du.getUsed();
     du.shutdown();
 
-    assertEquals(writtenSize, duSize);
+    assertTrue("Invalid on-disk size",
+        duSize >= writtenSize &&
+        writtenSize <= (duSize + slack));
     
     //test with 0 interval, will not launch thread 
     du = new DU(file, 0);
@@ -84,12 +89,16 @@ public class TestDU extends TestCase {
     duSize = du.getUsed();
     du.shutdown();
     
-    assertEquals(writtenSize, duSize);  
+    assertTrue("Invalid on-disk size",
+        duSize >= writtenSize &&
+        writtenSize <= (duSize + slack));
     
     //test without launching thread 
     du = new DU(file, 10000);
     duSize = du.getUsed();
-    
-    assertEquals(writtenSize, duSize);     
+
+    assertTrue("Invalid on-disk size",
+        duSize >= writtenSize &&
+        writtenSize <= (duSize + slack));
   }
 }


Reply via email to