-
Notifications
You must be signed in to change notification settings - Fork 75
Added methods to create new test worker with options and custom clients #81
Conversation
Signed-off-by: grantfuhr <grant.fuhr@datadoghq.com>
Signed-off-by: grantfuhr <grant.fuhr@datadoghq.com>
Codecov Report
@@ Coverage Diff @@
## main #81 +/- ##
==========================================
+ Coverage 37.71% 40.81% +3.09%
==========================================
Files 12 13 +1
Lines 814 860 +46
==========================================
+ Hits 307 351 +44
Misses 485 485
- Partials 22 24 +2
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
Signed-off-by: grantfuhr <grant.fuhr@datadoghq.com>
Signed-off-by: grantfuhr <grant.fuhr@datadoghq.com>
Signed-off-by: grantfuhr <grant.fuhr@datadoghq.com>
Signed-off-by: grantfuhr <grant.fuhr@datadoghq.com>
New worker with options
Signed-off-by: grantfuhr <grant.fuhr@datadoghq.com>
@@ -39,10 +40,43 @@ func (ts *TestServer) fatal(err error) { | |||
} | |||
|
|||
// Worker registers and starts a Temporal worker on the specified task queue. | |||
// WorkflowPanicPolicy is set to worker.FailWorkflow | |||
func (ts *TestServer) Worker(taskQueue string, registerFunc func(registry worker.Registry)) worker.Worker { |
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.
Hmm just thinking out loud, we should probably deprecate this and rename to NewWorker
before the first release. That would be more consistent with NewClientWithOptions
and NewWorkerWithOptions
.
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.
I can work on a followup PR that changes this. Should it be a breaking change, or should it support both methods?
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.
We can just mark as deprecated for now (no breaking change), and then remove it before the first tagged release.
temporaltest/server.go
Outdated
w := worker.New(ts.Client(), taskQueue, worker.Options{ | ||
WorkflowPanicPolicy: worker.FailWorkflow, | ||
}) | ||
ts.defaultWorkerOptions.WorkflowPanicPolicy = worker.FailWorkflow |
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.
Nit: calling this function probably shouldn't have a side effect of modifying TestServer
fields. Instead we should set any defaults necessary during initialization.
Co-authored-by: Jacob LeGrone <jlegrone@users.noreply.github.com>
Signed-off-by: grantfuhr <grant.fuhr@datadoghq.com>
Signed-off-by: grantfuhr <grant.fuhr@datadoghq.com>
Signed-off-by: grantfuhr grant.fuhr@datadoghq.com
What changed?
Added new methods for creating test workers with default options, custom options and custom clients.
Why?
I would like to test interceptors with the temporalite testing framework.
How did you test it?
I added a unit tests.
Potential risks
Minimal risk. Only the new methods could break.
Is hotfix candidate?
No