Browse Source

HADOOP-1640. Fix TestDecommission on Windows. Contributed by Dhruba.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@559068 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 years ago
parent
commit
a5dab021d4
2 changed files with 17 additions and 4 deletions
  1. 3 0
      CHANGES.txt
  2. 14 4
      src/test/org/apache/hadoop/dfs/TestDecommission.java

+ 3 - 0
CHANGES.txt

@@ -407,6 +407,9 @@ Branch 0.14 (unreleased changes)
 135. HADOOP-1619.  Fix FSInputChecker to not attempt to read past EOF.
      (Hairong Kuang via cutting)
 
+136. HADOOP-1640.  Fix TestDecommission on Windows.
+     (Dhruba Borthakur via cutting)
+
 
 Release 0.13.0 - 2007-06-08
 

+ 14 - 4
src/test/org/apache/hadoop/dfs/TestDecommission.java

@@ -24,6 +24,7 @@ import java.util.Random;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.net.*;
+import java.lang.InterruptedException;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FSDataOutputStream;
 import org.apache.hadoop.fs.FileSystem;
@@ -83,10 +84,19 @@ public class TestDecommission extends TestCase {
   
   private void checkFile(FileSystem fileSys, Path name, int repl)
     throws IOException {
-    String[][] locations = fileSys.getFileCacheHints(name, 0, fileSize);
-    for (int idx = 0; idx < locations.length; idx++) {
-      assertEquals("Number of replicas for block" + idx,
-                   Math.min(numDatanodes, repl), locations[idx].length);  
+    boolean done = false;
+    while (!done) {
+      try {
+        Thread.sleep(1000);
+      } catch (InterruptedException e) {}
+      done = true;
+      String[][] locations = fileSys.getFileCacheHints(name, 0, fileSize);
+      for (int idx = 0; idx < locations.length; idx++) {
+        if (locations[idx].length < repl) {
+          done = false;
+          break;
+        }
+      }
     }
   }