diff --git a/client/workflow/workflow.go b/client/workflow/workflow.go index 4324448..a72bee2 100644 --- a/client/workflow/workflow.go +++ b/client/workflow/workflow.go @@ -229,7 +229,7 @@ func Interceptor(ctx context.Context, method string, req, reply interface{}, cc logger.Debugf("grpc client calling: %s%s %v", cc.Target(), method, dtmimp.MustMarshalString(req)) wf, _ := ctx.Value(wfMeta{}).(*Workflow) if wf == nil { - return nil + return invoker(ctx, method, req, reply, cc, opts...) } origin := func() error { diff --git a/test/workflow_interceptor_test.go b/test/workflow_interceptor_test.go new file mode 100644 index 0000000..4c23112 --- /dev/null +++ b/test/workflow_interceptor_test.go @@ -0,0 +1,19 @@ +package test + +import ( + "context" + "testing" + + "github.com/dtm-labs/dtm/client/workflow" + "github.com/stretchr/testify/assert" + "google.golang.org/grpc" +) + +func TestWorkflowInterceptorOutsideSaga(t *testing.T) { + called := false + workflow.Interceptor(context.TODO(), "method", nil, nil, &grpc.ClientConn{}, func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, opts ...grpc.CallOption) error { + called = true + return nil + }) + assert.True(t, called) +}