Motivation:
The `leak` Maven profile replaces the default JUnit extension
autodetection argLine with paranoid Netty leak detection. Explicit tests
that use `@ExtendWith(LeakPresenceExtension.class)` can still load
`LeakPresenceExtension`, whose static initializer installs
`WithTransferableScope` globally via
`io.netty.customResourceLeakDetector`.
In handler tests, classes run concurrently, so this can route unrelated
tests through the leak presence detector without a per-test scope and
trigger `Resource created outside test?` failures.
Modification:
Add a dedicated `io.netty.test.leakPresenceDetection.disabled` system
property to the `leak` profile.
When this property is set, `LeakPresenceExtension`:
- skips installing the leak presence detector globally
- disables tests that explicitly opt into the extension through the
extension's own `ExecutionCondition`
The existing strict missing-scope behavior in
`WithTransferableScope.currentScope()` is unchanged.
Result:
The `leak` profile uses paranoid leak detection without enabling
incompatible leak presence detection for explicit extension tests,
avoiding cross-test contamination in parallel test runs.
Verified with:
- `./mvnw -pl testsuite-common -am -Dtest=LeakPresenceExtensionTest
-Dsurefire.failIfNoSpecifiedTests=false test`
- `./mvnw -Pleak -pl handler -am
-Dtest=OpenSslCredentialBuilderTest,OpenSslEngineTest
-Dsurefire.failIfNoSpecifiedTests=false test`
Resolves #17067
Co-authored-by: multicode <multicode@yawk.at>
(cherry picked from commit 9f403a8)
Auto-port of #17073 to 5.0
Cherry-picked commit: 9f403a8
Motivation:
The leak Maven profile replaces the default JUnit extension autodetection argLine with paranoid Netty leak detection. Explicit tests that use @ExtendWith(LeakPresenceExtension.class) can still load LeakPresenceExtension, whose static initializer installs WithTransferableScope globally via io.netty.customResourceLeakDetector.
In handler tests, classes run concurrently, so this can route unrelated tests through the leak presence detector without a per-test scope and trigger Resource created outside test? failures.
Modification:
Add a dedicated io.netty.test.leakPresenceDetection.disabled system property to the leak profile.
When this property is set, LeakPresenceExtension:
The existing strict missing-scope behavior in WithTransferableScope.currentScope() is unchanged.
Result:
The leak profile uses paranoid leak detection without enabling incompatible leak presence detection for explicit extension tests, avoiding cross-test contamination in parallel test runs.
Verified with:
Resolves #17067