From 274c6c73b08ac6231cd68a131df0c1ae16633d91 Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Thu, 10 Oct 2019 13:59:09 +0100 Subject: [PATCH] HADOOP-16650. ITestS3AClosedFS failing -junit test thread. Change-Id: Ia58f5e1dd57588a28081f9c4092c010b3132856a --- .../test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java index 592c4be907db1..c8e0d368793af 100644 --- a/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java +++ b/hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/S3ATestUtils.java @@ -1396,13 +1396,17 @@ public static Set listInitialThreadsForLifecycleChecks() { } /** - * 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 getCurrentThreadNames() { - return Thread.getAllStackTraces().keySet() + TreeSet 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; } }