chore: Flaky test in AuthenticationServiceTest#35538
Conversation
WalkthroughThe recent changes in the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AuthenticationServiceCEImpl.java (1 hunks)
Additional comments not posted (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/AuthenticationServiceCEImpl.java (1)
143-144: Good use of lambda for clarity.The introduction of a lambda function to handle
validateRequiredFieldsForGenericOAuth2with the datasource (ds) improves the readability and maintainability of the code. This makes the data flow clearer and easier to follow.
Failed server tests
|
| .flatMap(ds -> this.validateRequiredFieldsForGenericOAuth2(ds) | ||
| .zipWith(Mono.zip(workspaceIdMono, trueEnvironmentIdCached, newPageMono))) |
There was a problem hiding this comment.
How will this change be any different than the execution which is already present.
The mono from .flatMap(this::validateRequiredFieldsForGenericOAuth2) was earlier being zipped with (Mono.zip(workspaceIdMono, trueEnvironmentIdCached, newPageMono)) which would mean that both these Monos will be executing in parallel.
With the new change
.flatMap(ds -> this.validateRequiredFieldsForGenericOAuth2(ds)
.zipWith(Mono.zip(workspaceIdMono, trueEnvironmentIdCached, newPageMono)))
we are still doing the same thing.
Should we use something like:
.flatMap(this::validateRequiredFieldsForGenericOAuth2)
.zipWhen(ds -> Mono.zip(workspaceIdMono, trueEnvironmentIdCached, newPageMono))
There was a problem hiding this comment.
@nsarupr the error is popping up because newPageMono is getting executed alongside of datasourceMonoCached. With the updated change we are making sure Monos will be executed within the flatMap which was not the case earlier.
Earlier:
.flatMap(this::validateRequiredFieldsForGenericOAuth2)
.zipWith(Mono.zip(workspaceIdMono, trueEnvironmentIdCached, newPageMono))
After changes:
.flatMap(ds -> this.validateRequiredFieldsForGenericOAuth2(ds)
.zipWith(Mono.zip(workspaceIdMono, trueEnvironmentIdCached, newPageMono))
)
Also zipWhen also works but thought, all the zipped entities should be within the same flatMap hence opted for this approach.
This also works:
.flatMap(this::validateRequiredFieldsForGenericOAuth2)
.zipWhen(ds -> Mono.zip(workspaceIdMono, trueEnvironmentIdCached, newPageMono))
There was a problem hiding this comment.
@abhvsn should we use zipWhen() for a cleaner code and better readability here?
There was a problem hiding this comment.
As stated I would not prefer that considering we are not using the returned value in zipWhen.
Description
AuthenticationServiceTest.testGetAuthorizationCodeURL_missingDatasourcenewPageMonowas getting executed before thedatasourceMonoCachedcan complete the execution.newPageMonoget's called only after the execution of datasourceMono is completed./test sanity
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10298256036
Commit: 16f3efb
Cypress dashboard.
Tags:
@tag.SanitySpec:
Thu, 08 Aug 2024 08:20:46 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit