-
Notifications
You must be signed in to change notification settings - Fork 215
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
Improve Update Workflow testing UX #1721
Improve Update Workflow testing UX #1721
Conversation
…ion for ergonomics
@Quinn-With-Two-Ns lmk if there's other improvements you were thinking about when you filed the issue that I didn't cover |
// TestUpdateCallback is a basic implementation of the UpdateCallbacks interface for testing purposes. | ||
// Tests are welcome to implement their own version of this interface if they need to test more complex | ||
// update logic. This is a simple implementation to make testing basic Workflow Updates easier. | ||
TestUpdateCallback struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue was intended to improve the UX for users so we would need to expose this https://github.com/temporalio/sdk-go/blob/master/testsuite/testsuite.go#L35
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops! didn't realize this was needed. Thanks for pointing it out
internal/workflow_testsuite.go
Outdated
// Tests are welcome to implement their own version of this interface if they need to test more complex | ||
// update logic. This is a simple implementation to make testing basic Workflow Updates easier. | ||
TestUpdateCallback struct { | ||
accept func() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These fields are private so you also need to make these public so the type can be constructed. To make them public you need to capitalize the first letter. I would also suggest prefixing them with On
to be a bit more consistent with the other test environment API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :) tested with temporalio/samples-go#371, hopefully not missing anything else
What was changed
Added default implementation
TestUpdateCallbacks
for basic test scenariosWhy?
so tests don't need to implement
UpdateCallbacks
themselves. To make testing a little easierChecklist
Closes Improve UX for testing Workflow Update with the Workflow Test Environment #1639
How was this tested:
existing unit tests that were effected still pass