Skip to content

Commit f017ef0

Browse files
committed
Suppress Thread Leak warning on BouncyCastle daemon
Signed-off-by: Daniel Widdis <[email protected]>
1 parent 024b994 commit f017ef0

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

distribution/tools/plugin-cli/src/test/java/org/opensearch/plugins/InstallPluginCommandTests.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
package org.opensearch.plugins;
3434

3535
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
36+
import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
3637

3738
import com.google.common.jimfs.Configuration;
3839
import com.google.common.jimfs.Jimfs;
@@ -71,6 +72,7 @@
7172
import org.opensearch.env.Environment;
7273
import org.opensearch.env.TestEnvironment;
7374
import org.opensearch.semver.SemverRange;
75+
import org.opensearch.test.BouncyCastleThreadFilter;
7476
import org.opensearch.test.OpenSearchTestCase;
7577
import org.opensearch.test.PosixPermissionsResetter;
7678
import org.opensearch.test.VersionUtils;
@@ -134,6 +136,7 @@
134136
import static org.hamcrest.Matchers.startsWith;
135137

136138
@LuceneTestCase.SuppressFileSystems("*")
139+
@ThreadLeakFilters(filters = BouncyCastleThreadFilter.class)
137140
public class InstallPluginCommandTests extends OpenSearchTestCase {
138141

139142
private InstallPluginCommand skipJarHellCommand;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*/
8+
9+
package org.opensearch.test;
10+
11+
import com.carrotsearch.randomizedtesting.ThreadFilter;
12+
13+
/**
14+
* ThreadFilter to exclude ThreadLeak checks for BC’s global background threads
15+
*/
16+
public class BouncyCastleThreadFilter implements ThreadFilter {
17+
@Override
18+
public boolean reject(Thread t) {
19+
String n = t.getName();
20+
// Ignore BC’s global background threads
21+
return "BC Disposal Daemon".equals(n) || "BC Cleanup Executor".equals(n);
22+
}
23+
}

0 commit comments

Comments
 (0)