@@ -42,6 +42,7 @@ import (
42
42
historypb "go.temporal.io/api/history/v1"
43
43
nexuspb "go.temporal.io/api/nexus/v1"
44
44
"go.temporal.io/api/operatorservice/v1"
45
+
45
46
"go.temporal.io/sdk/client"
46
47
"go.temporal.io/sdk/internal/common/metrics"
47
48
ilog "go.temporal.io/sdk/internal/log"
@@ -320,6 +321,11 @@ func TestSyncOperationFromWorkflow(t *testing.T) {
320
321
tc := newTestContext (t , ctx )
321
322
322
323
op := temporalnexus .NewSyncOperation ("op" , func (ctx context.Context , c client.Client , outcome string , o nexus.StartOperationOptions ) (string , error ) {
324
+ require .NotPanicsf (t , func () {
325
+ temporalnexus .GetMetricsHandler (ctx )
326
+ temporalnexus .GetLogger (ctx )
327
+ }, "Failed to get metrics handler or logger from operation context." )
328
+
323
329
switch outcome {
324
330
case "successful" :
325
331
return outcome , nil
@@ -445,6 +451,11 @@ func TestAsyncOperationFromWorkflow(t *testing.T) {
445
451
}
446
452
}
447
453
op := temporalnexus .NewWorkflowRunOperation ("op" , handlerWorkflow , func (ctx context.Context , action string , soo nexus.StartOperationOptions ) (client.StartWorkflowOptions , error ) {
454
+ require .NotPanicsf (t , func () {
455
+ temporalnexus .GetMetricsHandler (ctx )
456
+ temporalnexus .GetLogger (ctx )
457
+ }, "Failed to get metrics handler or logger from operation context." )
458
+
448
459
if action == "fail-to-start" {
449
460
return client.StartWorkflowOptions {}, nexus .HandlerErrorf (nexus .HandlerErrorTypeInternal , "fake internal error" )
450
461
}
@@ -677,6 +688,11 @@ func TestReplay(t *testing.T) {
677
688
678
689
func TestWorkflowTestSuite_NexusSyncOperation (t * testing.T ) {
679
690
op := nexus .NewSyncOperation ("op" , func (ctx context.Context , outcome string , opts nexus.StartOperationOptions ) (string , error ) {
691
+ require .NotPanicsf (t , func () {
692
+ temporalnexus .GetMetricsHandler (ctx )
693
+ temporalnexus .GetLogger (ctx )
694
+ }, "Failed to get metrics handler or logger from operation context." )
695
+
680
696
switch outcome {
681
697
case "ok" :
682
698
return outcome , nil
@@ -765,6 +781,11 @@ func TestWorkflowTestSuite_WorkflowRunOperation(t *testing.T) {
765
781
"op" ,
766
782
handlerWF ,
767
783
func (ctx context.Context , id string , opts nexus.StartOperationOptions ) (client.StartWorkflowOptions , error ) {
784
+ require .NotPanicsf (t , func () {
785
+ temporalnexus .GetMetricsHandler (ctx )
786
+ temporalnexus .GetLogger (ctx )
787
+ }, "Failed to get metrics handler or logger from operation context." )
788
+
768
789
return client.StartWorkflowOptions {ID : opts .RequestID }, nil
769
790
})
770
791
0 commit comments