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

Provide the ability to Mock WorkflowActivityContext #1358

Merged
merged 72 commits into from
Dec 28, 2024

Conversation

siri-varma
Copy link
Contributor

@siri-varma siri-varma commented Oct 10, 2024

Description

Made the WorkflowActivityContext abstract.
Created DaprWorkflowActivityContext and made it inherit from WorkflowActivityContext

Issue reference

We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.

Please reference the issue this PR will close: #1200

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

@WhitWaldo
Copy link
Contributor

@siri-varma It looks like the DCO check failed.

Could you please make sure each of your commits are signed?

Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
@siri-varma siri-varma force-pushed the users/svegira/make-context-mockable branch from a0e576f to f51def0 Compare October 10, 2024 21:02
@WhitWaldo
Copy link
Contributor

@siri-varma Looks like we've got several build errors regarding nullability. If you can fix those, I'd appreciate it!

m3nax and others added 21 commits December 20, 2024 14:38
…xunit.runner.visualstudio, Microsoft.AspNetCore.Mvc.Testing, Moq to the same version in all projects.

Signed-off-by: Manuel Menegazzo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
…quest

Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
…d types

Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
…ality has been moved out to the Dapr.Workflow project instead.

Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
This PR takes the implementation of the static method and puts it into the DaprClient instance, pulling from the existing apiTokenHeader on the instance to populate the daprApiToken, pulling the endpoint from the instance's httpEndpoint value and accepting only an appId argument so as to specify the ID of the Dapr app to connect to and place in the resulting URI.

---------

Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
…irect) (dapr#1366)

Migrating whole solution to Central Package Management - several package version upgrades to address security advisories and otherwise.

---------

Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Extracting classes out to common project

---------

Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Protos pulled out to separate shared project

Signed-off-by: Siri Varma Vegiraju <[email protected]>
Add link about Dapr bot to contribution documentation

Signed-off-by: Siri Varma Vegiraju <[email protected]>
…rops s headers (dapr#1153)

* forward cloudevent props
Signed-off-by: Ilias Politsopoulos <[email protected]>

* refactor middleware
Signed-off-by: Ilias Politsopoulos <[email protected]>

* add cloud event property filters
Signed-off-by: Ilias Politsopoulos <[email protected]>

* update string check
Signed-off-by: Ilias Politsopoulos <[email protected]>

* forward cloudevent props
Signed-off-by: Ilias Politsopoulos <[email protected]>

* refactor middleware
Signed-off-by: Ilias Politsopoulos <[email protected]>

* add cloud event property filters
Signed-off-by: Ilias Politsopoulos <[email protected]>

* update checks
Signed-off-by: Ilias Politsopoulos <[email protected]>

---------

Signed-off-by: Whit Waldo <[email protected]>
Co-authored-by: Whit Waldo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
* Changed headers, updated introduction to reflect the difference in serialization between either type and added a brief section to detail the use of System.Text.Json for weakly-typed Dapr actor clients and to point to official documentation on it

---------

Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
…tead of directly (dapr#1363)

* Implemented against Dapr.Client.AspNetCore and Dapr.Client

Signed-off-by: Whit Waldo <[email protected]>

* SImplified DaprWorkflow DI registration and updated to use IConfiguration preference. Needs testing.

Signed-off-by: Whit Waldo <[email protected]>

* Added missing copyright header

Signed-off-by: Whit Waldo <[email protected]>

* Updated actor registration to prefer the updated IConfiguration-based approach for pulling the HTTP endpoint and API token

Signed-off-by: Whit Waldo <[email protected]>

* Adopted accepted proposal's guidelines for favoring different environment variables for determining the sidecar endpoint. Added notes to explain this in the code going forward.

Signed-off-by: Whit Waldo <[email protected]>

* Made some lines a little more concise, added hostname default to DaprDefaults to use when building endpoints.

Signed-off-by: Whit Waldo <[email protected]>

* Fixed and updated unit tests

Signed-off-by: Whit Waldo <[email protected]>

* Updated to put endpoint resolution mechanism in DaprDefaults within Dapr.Common  - updating projects and unit tests

Signed-off-by: Whit Waldo <[email protected]>

* Updated packages to fix security advisory GHSA-447r-wph3-92pm

Signed-off-by: Whit Waldo <[email protected]>

* Updated Workflow builder to use DaprDefaults with IConfiguration

Signed-off-by: Whit Waldo <[email protected]>

* Updating global.json

Signed-off-by: Whit Waldo <[email protected]>

* Tweaked global.json comment

Signed-off-by: Whit Waldo <[email protected]>

* Adding braces per nit

Signed-off-by: Whit Waldo <[email protected]>

* Consolidated both registration extension methods to remove duplication

Signed-off-by: Whit Waldo <[email protected]>

---------

Signed-off-by: Whit Waldo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
* Removed Serilog nuget from Directory.Packages.props

Signed-off-by: Manuel Menegazzo <[email protected]>

* Update Directory.Packages.props

Signed-off-by: Manuel Menegazzo <[email protected]>

---------

Signed-off-by: Manuel Menegazzo <[email protected]>
Signed-off-by: Manuel Menegazzo <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
siri-varma and others added 9 commits December 20, 2024 14:55
…Properties/launchSettings.json

Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
@siri-varma siri-varma force-pushed the users/svegira/make-context-mockable branch from 3461bc9 to 8f27ba7 Compare December 20, 2024 23:08
siri-varma and others added 4 commits December 20, 2024 21:00
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
@siri-varma siri-varma force-pushed the users/svegira/make-context-mockable branch from 7c684dc to e3e6b0a Compare December 21, 2024 06:43
svegiraju-microsoft and others added 3 commits December 20, 2024 22:45
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
…Properties/launchSettings.json

Signed-off-by: Siri Varma Vegiraju <[email protected]>
Signed-off-by: Siri Varma Vegiraju <[email protected]>
@siri-varma siri-varma force-pushed the users/svegira/make-context-mockable branch from f81134b to ea4ac28 Compare December 21, 2024 06:46
@siri-varma
Copy link
Contributor Author

@WhitWaldo let me know if anything else is needed on this PR. Thank you

@siri-varma siri-varma closed this Dec 27, 2024
@siri-varma siri-varma reopened this Dec 27, 2024
Copy link
Contributor

@WhitWaldo WhitWaldo left a comment

Choose a reason for hiding this comment

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

Just a couple of nits and we're good here.

src/Dapr.Workflow/WorkflowActivityContext.cs Outdated Show resolved Hide resolved
@WhitWaldo WhitWaldo merged commit 8b9f932 into dapr:master Dec 28, 2024
12 checks passed
@WhitWaldo
Copy link
Contributor

Thank you very much for your contribution @siri-varma !

@WhitWaldo WhitWaldo added this to the v1.15 milestone Dec 28, 2024
@siri-varma siri-varma deleted the users/svegira/make-context-mockable branch December 28, 2024 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WorkflowActivityContext cannot be mocked