Skip to content

Commit 15c7983

Browse files
committed
React to client tracing in tests
1 parent 2b0ada2 commit 15c7983

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

client/client_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/google/uuid"
1717
"github.com/stretchr/testify/mock"
1818
"github.com/stretchr/testify/require"
19+
"go.opentelemetry.io/otel/trace"
1920
)
2021

2122
func Test_Client_CreateWorkflowInstance_ParamMismatch(t *testing.T) {
@@ -45,6 +46,7 @@ func Test_Client_GetWorkflowResultTimeout(t *testing.T) {
4546
ctx := context.Background()
4647

4748
b := &backend.MockBackend{}
49+
b.On("Tracer").Return(trace.NewNoopTracerProvider().Tracer("test"))
4850
b.On("GetWorkflowInstanceState", mock.Anything, instance).Return(core.WorkflowInstanceStateActive, nil)
4951

5052
c := &client{
@@ -68,6 +70,7 @@ func Test_Client_GetWorkflowResultSuccess(t *testing.T) {
6870
r, _ := converter.DefaultConverter.To(42)
6971

7072
b := &backend.MockBackend{}
73+
b.On("Tracer").Return(trace.NewNoopTracerProvider().Tracer("test"))
7174
b.On("GetWorkflowInstanceState", mock.Anything, instance).Return(core.WorkflowInstanceStateActive, nil).Once().Run(func(args mock.Arguments) {
7275
// After the first call, advance the clock to immediately go to the second call below
7376
mockClock.Add(time.Second)
@@ -99,9 +102,10 @@ func Test_Client_SignalWorkflow(t *testing.T) {
99102
ctx := context.Background()
100103

101104
b := &backend.MockBackend{}
105+
b.On("Tracer").Return(trace.NewNoopTracerProvider().Tracer("test"))
102106
b.On("Logger").Return(logger.NewDefaultLogger())
103107
b.On("Converter").Return(converter.DefaultConverter)
104-
b.On("SignalWorkflow", ctx, instanceID, mock.MatchedBy(func(event *history.Event) bool {
108+
b.On("SignalWorkflow", mock.Anything, instanceID, mock.MatchedBy(func(event *history.Event) bool {
105109
return event.Type == history.EventType_SignalReceived &&
106110
event.Attributes.(*history.SignalReceivedAttributes).Name == "test"
107111
})).Return(nil)
@@ -127,9 +131,10 @@ func Test_Client_SignalWorkflow_WithArgs(t *testing.T) {
127131
input, _ := converter.DefaultConverter.To(arg)
128132

129133
b := &backend.MockBackend{}
134+
b.On("Tracer").Return(trace.NewNoopTracerProvider().Tracer("test"))
130135
b.On("Logger").Return(logger.NewDefaultLogger())
131136
b.On("Converter").Return(converter.DefaultConverter)
132-
b.On("SignalWorkflow", ctx, instanceID, mock.MatchedBy(func(event *history.Event) bool {
137+
b.On("SignalWorkflow", mock.Anything, instanceID, mock.MatchedBy(func(event *history.Event) bool {
133138
return event.Type == history.EventType_SignalReceived &&
134139
event.Attributes.(*history.SignalReceivedAttributes).Name == "test" &&
135140
bytes.Equal(event.Attributes.(*history.SignalReceivedAttributes).Arg, input)

0 commit comments

Comments
 (0)