Update DaprClientGrpcTest.java #1442
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.