-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MonoFirstWithValue missing tests #3915
Conversation
c2a07d6
to
d5d79d0
Compare
d5d79d0
to
814cdc0
Compare
@violetagg can this pr be reviewed? |
@subbarao We definitely will make a review so bear with us. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@subbarao thanks for the PR. Please rewrite your test in a way that avoids Thread.sleep()
but relies on more reliable and timely synchronization mechanisms, e.g. CountDownLatch
. Using Thread.sleep
in tests and relying on actual time passing contributes negatively to the overall CI duration and can also be prone to flakiness due to different scheduling, delays, etc.
3948b76
to
d6769b3
Compare
updated pr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for applying the review comment and your contribution! 🚢
This test seems to be flaky though. I just had it fail after a PR merge in https://github.com/reactor/reactor-core/actions/runs/11793828102
I will revert. Please try evaluating it by running the test e.g. 1k times (Intellij IDEA allows you to do that using non-gradle test run) and make sure there's some synchronization. @subbarao my guess is that the validation can happen while the cancellation lambdas are being executed. The thing I'd try would be to have another latch which the test would wait on before all cancellations are done and only then perform assertions. Maybe StepVerifier is not the right tool for this test as this asynchrony is getting in the way - completion can happen simultaneously to the cancellations being processed and that simple API doesn't make it easy to get things properly sequenced. |
Adding missing tests for MonoFirstWithValue.
MonoFirstWithValue tests which verifies cancellation of in flight publishers when first value is emitted is missing.
If you comment https://github.com/reactor/reactor-core/blob/main/reactor-core/src/main/java/reactor/core/publisher/FluxFirstWithValue.java#L283 current tests will pass.
In this test case we start three monos with 3 different sleep. Once Mono with lowest delay completes we verify remaining
monos are cancelled.