Переглянути джерело

HADOOP-696. Fix TestTextInputFormat to not rely on the order of directory listings. Contributed by Sameer.

git-svn-id: https://svn.apache.org/repos/asf/lucene/hadoop/trunk@473439 13f79535-47bb-0310-9956-ffa450edef68
Doug Cutting 18 роки тому
батько
коміт
f830175707

+ 3 - 0
CHANGES.txt

@@ -38,6 +38,9 @@ Trunk (unreleased changes)
     are not collected like normal buffers, and provided little
     are not collected like normal buffers, and provided little
     advantage.  (Raghu Angadi via cutting)
     advantage.  (Raghu Angadi via cutting)
 
 
+12. HADOOP-696.  Fix TestTextInputFormat unit test to not rely on the
+    order of directory listings.  (Sameer Paranjpye via cutting)
+
 
 
 Release 0.8.0 - 2006-11-03
 Release 0.8.0 - 2006-11-03
 
 

+ 5 - 0
src/test/org/apache/hadoop/mapred/TestTextInputFormat.java

@@ -215,6 +215,11 @@ public class TestTextInputFormat extends TestCase {
     format.configure(job);
     format.configure(job);
     FileSplit[] splits = format.getSplits(localFs, job, 100);
     FileSplit[] splits = format.getSplits(localFs, job, 100);
     assertEquals("compressed splits == 2", 2, splits.length);
     assertEquals("compressed splits == 2", 2, splits.length);
+    if (splits[0].getPath().getName().equals("part2.txt.gz")) {
+      FileSplit tmp = splits[0];
+      splits[0] = splits[1];
+      splits[1] = tmp;
+    }
     List<Text> results = readSplit(format, splits[0], job);
     List<Text> results = readSplit(format, splits[0], job);
     assertEquals("splits[0] length", 6, results.size());
     assertEquals("splits[0] length", 6, results.size());
     assertEquals("splits[0][5]", " dog", results.get(5).toString());
     assertEquals("splits[0][5]", " dog", results.get(5).toString());