HADOOP-6933. TestListFiles is flaky. Contributed by Todd Lipcon.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1005581 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bf9fccca0c
commit
a503521a2c
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue