File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -95,15 +95,18 @@ func TestStandardCapabilityCallsAreAsync(t *testing.T) {
9595 assert .Equal (t , "PerformAction" , request .Method )
9696 input := & basicaction.Inputs {}
9797 assert .NoError (t , request .Payload .UnmarshalTo (input ))
98- assert .False (t , callsSeen [input .InputThing ])
99- callsSeen [input .InputThing ] = true
100- payload , err := anypb .New (& basicaction.Outputs {AdaptedThing : fmt .Sprintf ("%t" , input .InputThing )})
101- require .NoError (t , err )
10298
10399 // Don't return until the second call has been executed
100+ // Take the lock before accessing callsSeen to avoid a race
104101 if input .InputThing {
105102 mt .Lock ()
106103 }
104+
105+ assert .False (t , callsSeen [input .InputThing ])
106+ callsSeen [input .InputThing ] = true
107+ payload , err := anypb .New (& basicaction.Outputs {AdaptedThing : fmt .Sprintf ("%t" , input .InputThing )})
108+ require .NoError (t , err )
109+
107110 defer mt .Unlock ()
108111 return & sdk.CapabilityResponse {
109112 Response : & sdk.CapabilityResponse_Payload {Payload : payload },
You can’t perform that action at this time.
0 commit comments