Skip to content

Fix flaky WebFluxSse integration test #238

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

Merged
merged 1 commit into from
May 15, 2025
Merged

Conversation

chemicL
Copy link
Member

@chemicL chemicL commented May 14, 2025

The WebFluxSseIntegrationTests.testLoggingNotification test is flaky and can fail with:

Expected size: 3 but was: 2 in:
[LoggingMessageNotification[level=NOTICE, logger=test-logger, data=Notice message],
    LoggingMessageNotification[level=ERROR, logger=test-logger, data=Another error message]]

When running this test in the IDE with 100 times (with 2 test params it means 200 runs) repeat mode, it can take 25s in the optimistic variant on my machine and occasionally fails for the JDK HttpClient variant.

With this change, repeating 100 times finishes in 4s. It essentially avoids using awaitility and instead relies on a CountDownLatch to coordinate completion. The flakiness comes from the fact that the results are aggregated in an ArrayList, which can fail to publish the results coming from asynchronous sources. The replacement used is a CopyOnWriteArrayList.

Signed-off-by: Dariusz Jędrzejczyk <dariusz.jedrzejczyk@broadcom.com>
@chemicL chemicL force-pushed the fix-flaky-webflux-test branch from 14878aa to 9b46be9 Compare May 14, 2025 21:17
@tzolov tzolov merged commit 2e13f9f into main May 15, 2025
1 check passed
@tzolov tzolov deleted the fix-flaky-webflux-test branch May 15, 2025 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants