merlimat opened a new pull request, #25560:
URL: https://github.com/apache/pulsar/pull/25560
## Summary
`PublishRateLimiterTest` has a latent bug: the class-level `eventLoop`
field is initialized once (at instance construction), but
`@AfterMethod tearDown()` calls `eventLoop.shutdownGracefully()` after
every test. TestNG reuses a single instance per class, so the second
test method to run in the class hits
`RejectedExecutionException: event executor terminated` when it calls
`eventLoop.execute(...)`.
Two recent additions to the class
(`shouldUnthrottleImmediatelyAfterDisablingLimitsDespiteLongPendingDelay`
and
`shouldUnthrottleImmediatelyAfterRaisingByteLimitDespiteLongPendingDelay`,
added in #25502) exposed the latent bug — in TestNG's alphabetical
default order, they run before `testPublishRateLimiterImplExceed`, and
their `tearDown` terminates the shared event loop.
The fix: move `eventLoop` creation into `@BeforeMethod` so each test
gets a fresh instance. `@AfterMethod tearDown()` continues to shut
it down at the end of each test.
## Test plan
- [x] `./gradlew :pulsar-broker:test --tests
"org.apache.pulsar.broker.service.PublishRateLimiterTest"`
all 4 tests pass.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]