You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by to...@apache.org on 2010/10/07 21:11:46 UTC

svn commit: r1005581 - in /hadoop/common/trunk: CHANGES.txt src/test/core/org/apache/hadoop/fs/TestListFiles.java

Author: tomwhite
Date: Thu Oct  7 19:11:45 2010
New Revision: 1005581

URL: http://svn.apache.org/viewvc?rev=1005581&view=rev
Log:
HADOOP-6933. TestListFiles is flaky. Contributed by Todd Lipcon.

Modified:
    hadoop/common/trunk/CHANGES.txt
    hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestListFiles.java

Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=1005581&r1=1005580&r2=1005581&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Thu Oct  7 19:11:45 2010
@@ -256,6 +256,8 @@ Trunk (unreleased changes)
     HADOOP-6984. Combine the compress kind and the codec in the same option
     for SequenceFiles. (cdouglas via omalley)
 
+    HADOOP-6933. TestListFiles is flaky. (Todd Lipcon via tomwhite)
+
 Release 0.21.1 - Unreleased
 
   IMPROVEMENTS

Modified: hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestListFiles.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestListFiles.java?rev=1005581&r1=1005580&r2=1005581&view=diff
==============================================================================
--- hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestListFiles.java (original)
+++ hadoop/common/trunk/src/test/core/org/apache/hadoop/fs/TestListFiles.java Thu Oct  7 19:11:45 2010
@@ -19,7 +19,9 @@ package org.apache.hadoop.fs;
 
 import java.io.IOException;
 import java.util.Iterator;
+import java.util.HashSet;
 import java.util.Random;
+import java.util.Set;
 
 import org.apache.commons.logging.impl.Log4JLogger;
 import org.apache.hadoop.conf.Configuration;
@@ -135,17 +137,28 @@ public class TestListFiles {
     writeFile(fs, FILE1, FILE_LEN);
     writeFile(fs, FILE3, FILE_LEN);
 
+    Set<Path> filesToFind = new HashSet<Path>();
+    filesToFind.add(fs.makeQualified(FILE1));
+    filesToFind.add(fs.makeQualified(FILE2));
+    filesToFind.add(fs.makeQualified(FILE3));
+
     itor = fs.listFiles(TEST_DIR, true);
     stat = itor.next();
     assertTrue(stat.isFile());
-    assertEquals(fs.makeQualified(FILE2), stat.getPath());
+    assertTrue("Path " + stat.getPath() + " unexpected",
+      filesToFind.remove(stat.getPath()));
+
     stat = itor.next();
     assertTrue(stat.isFile());
-    assertEquals(fs.makeQualified(FILE3), stat.getPath());
+    assertTrue("Path " + stat.getPath() + " unexpected",
+      filesToFind.remove(stat.getPath()));
+
     stat = itor.next();
     assertTrue(stat.isFile());
-    assertEquals(fs.makeQualified(FILE1), stat.getPath());
+    assertTrue("Path " + stat.getPath() + " unexpected",
+      filesToFind.remove(stat.getPath()));
     assertFalse(itor.hasNext());
+    assertTrue(filesToFind.isEmpty());
     
     itor = fs.listFiles(TEST_DIR, false);
     stat = itor.next();