瀏覽代碼

HADOOP-16650. ITestS3AClosedFS failing.

Contributed by Steve Loughran.

Change-Id: Ia9bb84bd6455e210a54cfe9eb944feeda8b58da9
Steve Loughran 5 年之前
父節點
當前提交
effe6087a5
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java

+ 6 - 2
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java

@@ -1396,13 +1396,17 @@ public final class S3ATestUtils {
   }
 
   /**
-   * Get a set containing the names of all active threads.
+   * Get a set containing the names of all active threads,
+   * stripping out all test runner threads.
    * @return the current set of threads.
    */
   public static Set<String> getCurrentThreadNames() {
-    return Thread.getAllStackTraces().keySet()
+    TreeSet<String> threads = Thread.getAllStackTraces().keySet()
         .stream()
         .map(Thread::getName)
+        .filter(n -> n.startsWith("JUnit"))
+        .filter(n -> n.startsWith("surefire"))
         .collect(Collectors.toCollection(TreeSet::new));
+    return threads;
   }
 }