Skip to content
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

Fix MonoPublishOnTest flakiness #3898

Merged
merged 2 commits into from
Oct 2, 2024
Merged

Fix MonoPublishOnTest flakiness #3898

merged 2 commits into from
Oct 2, 2024

Conversation

chemicL
Copy link
Member

@chemicL chemicL commented Oct 2, 2024

The implementation relied on a specific sequencing of events, which in case of slower hardware or random events would occasionally fail the assertions. This change introduces firm ordering and fixes an incorrect assertion, which assumed the Mono terminates without error, while in fact the RejectedExecutionException is propagated to the AssertSubscriber. In effect, the tests are no longer flaky.

The implementation relied on a specific sequencing of events, which in
case of slower hardware or random events would occasionally fail the
assertions. This change introduces firm ordering and fixes an incorrect
assertion, which assumed the `Mono` terminates without error, while in
fact the `RejectedExecutionException` is propagated to the
`AssertSubscriber`. In effect, the tests are no longer flaky.
@chemicL chemicL added the type/test A change in test sources label Oct 2, 2024
@chemicL chemicL added this to the 3.6.11 milestone Oct 2, 2024
@chemicL chemicL requested a review from a team as a code owner October 2, 2024 13:09
Copy link
Member

@violetagg violetagg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

except some formatting issues, it is ok

@@ -127,23 +130,26 @@ public void rejectedExecutionExceptionOnErrorSignalExecutor()
.publishOn(fromExecutorService(executor))
.doOnNext(s -> {
try {
inOnNextLatch.countDown();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you may want to fix the formatting

latch.await();
}
catch (InterruptedException e) {
throw Exceptions.propagate(exception);
}
})
.publishOn(fromExecutor(executor))
.doFinally(s -> finallyLatch.countDown())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you may want to fix the formatting

@@ -182,22 +188,25 @@ public void rejectedExecutionExceptionOnDataSignalExecutorService()
.publishOn(fromExecutorService(executor))
.doOnNext(s -> {
try {
inOnNextLatch.countDown();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you may want to fix the formatting

latch.await();
}
catch (InterruptedException e) {
}
})
.publishOn(fromExecutorService(executor))
.doFinally(s -> finallyLatch.countDown())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you may want to fix the formatting

@@ -236,23 +245,26 @@ public void rejectedExecutionExceptionOnErrorSignalExecutorService()
.publishOn(fromExecutorService(executor))
.doOnNext(s -> {
try {
inOnNextLatch.countDown();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you may want to fix the formatting

@chemicL
Copy link
Member Author

chemicL commented Oct 2, 2024

except some formatting issues, it is ok

Thanks. I think I addressed all of them now.

@chemicL chemicL merged commit aa26c12 into 3.6.x Oct 2, 2024
8 checks passed
@chemicL chemicL deleted the flaky-mono-publish-on-test branch October 2, 2024 13:41
chemicL added a commit that referenced this pull request Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/test A change in test sources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants