diff --git a/CHANGES.txt b/CHANGES.txt index f188ec6553c..4a6782840ba 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/src/test/core/org/apache/hadoop/fs/TestListFiles.java b/src/test/core/org/apache/hadoop/fs/TestListFiles.java index d54b52b190c..6f3c270232d 100644 --- a/src/test/core/org/apache/hadoop/fs/TestListFiles.java +++ b/src/test/core/org/apache/hadoop/fs/TestListFiles.java @@ -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 filesToFind = new HashSet(); + 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();