Ver código fonte

HADOOP-3195. Fix TestFileSystem to be deterministic.
Contributed by Tsz Wo (Nicholas), SZE.



git-svn-id: https://svn.apache.org/repos/asf/hadoop/core/branches/branch-0.16@645743 13f79535-47bb-0310-9956-ffa450edef68

Christopher Douglas 17 anos atrás
pai
commit
2fb222e34e
2 arquivos alterados com 4 adições e 5 exclusões
  1. 2 0
      CHANGES.txt
  2. 2 5
      src/test/org/apache/hadoop/fs/TestFileSystem.java

+ 2 - 0
CHANGES.txt

@@ -17,6 +17,8 @@ Release 0.16.3 - Unreleased
     closeAll() that causes spurious warnings and a deadlock.
     (Tsz Wo (Nicholas), SZE via cdouglas)
 
+    HADOOP-3195. Fix TestFileSystem to be deterministic.
+    (Tsz Wo (Nicholas), SZE via cdouglas)
 
 Release 0.16.2 - 2008-04-02
 

+ 2 - 5
src/test/org/apache/hadoop/fs/TestFileSystem.java

@@ -495,12 +495,9 @@ public class TestFileSystem extends TestCase {
       try {
         cluster = new MiniDFSCluster(new Configuration(), 2, true, null);
         URI uri = cluster.getFileSystem().getUri();
-        FileSystem.get(uri, new Configuration());
-        int n = Thread.activeCount();
+        FileSystem fs = FileSystem.get(uri, new Configuration());
         for(int i = 0; i < 100; i++) {
-          FileSystem.get(uri, new Configuration());
-          Thread.sleep(100);
-          assertTrue(n >= Thread.activeCount());
+          assertTrue(fs == FileSystem.get(uri, new Configuration()));
         }
       } finally {
         cluster.shutdown();