Skip to content

Update DaprClientGrpcTest.java #1442

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

Closed

Conversation

love12yadav
Copy link

@love12yadav love12yadav commented Jul 6, 2025

Description
This PR fixes a bug in the getStateThenDelete test in DaprClientGrpcTest.

Problem:
The test previously called client.getState(...) for key2 and stored it as a Mono, but did not block it immediately. Then it deleted the state using deleteState(...) and blocked that operation, meaning the deletion happened before the earlier getState was actually executed.

Despite the state having been deleted, the test incorrectly expected that the delayed .block() on getState would return the original value — which is incorrect. In a reactive system, the delayed getState should reflect the current store contents, which no longer include the deleted key.

Fix Summary:
Delayed the .block() on getState for key2 until after the deleteState call was executed.

Updated the mock to simulate that the state is removed after deletion.

Changed the test to correctly assert that the state value is null after deletion.

This aligns the test with the correct reactive behavior of the Dapr Java SDK.

Issue reference
Fixes: #1408

@salaboy and @siri-varma.

@love12yadav love12yadav requested review from a team as code owners July 6, 2025 05:10
@siri-varma
Copy link
Contributor

@love12yadav Can you please look at the failing tests ?

Copy link
Contributor

@artur-ciocanu artur-ciocanu left a comment

Choose a reason for hiding this comment

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

@love12yadav thank you for your PR. It seems that you have a few white spaces changes and line breaks that adds noise.

Could you please make sure that you maintain the format and add just the changes that improves the test. Otherwise it is unclear which line is part of the improvement and which one is just formatting changes.

Thank you.

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.

Bug in getStateThenDelete test: Asserts deleted state is still returned
3 participants