Skip to content

Commit 4cb04c3

Browse files
authored
Forbid use of ClassLoader APIs for disabling assertions (opensearch-project#20000)
Programmatically disabling assertions in tests will disable assertions for all classes loaded in that JVM instance. This will cause suprious test failures in random tests depending on where and when they get executed. Signed-off-by: Andrew Ross <andrross@amazon.com>
1 parent 6966267 commit 4cb04c3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

buildSrc/src/main/resources/forbidden/opensearch-test-signatures.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@ com.carrotsearch.randomizedtesting.annotations.Nightly @ We don't run nightly te
2626
org.junit.Test @defaultMessage Just name your test method testFooBar
2727

2828
java.lang.Math#random() @ Use one of the various randomization methods from LuceneTestCase or OpenSearchTestCase for reproducibility
29+
30+
@defaultMessage Disabling assertions is a JVM-wide setting and will break other tests
31+
java.lang.ClassLoader#setDefaultAssertionStatus(boolean)
32+
java.lang.ClassLoader#setPackageAssertionStatus(java.lang.String, boolean)
33+
java.lang.ClassLoader#setClassAssertionStatus(java.lang.String, boolean)

0 commit comments

Comments
 (0)