Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions pkg/workflows/wasm/host/standard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ func TestStandardErrors(t *testing.T) {
}

func TestStandardCapabilityCallsAreAsync(t *testing.T) {
// This test expects basic action's PerformAction to be called twice asynchronously and the results concatenated.
// To ensure the calls are actually async, the mock will block the first call until the second call is made.
// The first call sets InputThing to true, the second to false.
t.Parallel()
mockExecutionHelper := NewMockExecutionHelper(t)
mockExecutionHelper.EXPECT().GetWorkflowExecutionID().Return("id")
Expand All @@ -98,12 +101,10 @@ func TestStandardCapabilityCallsAreAsync(t *testing.T) {
require.NoError(t, err)

// Don't return until the second call has been executed
defer func() {
if !input.InputThing {
mt.Lock()
}
defer mt.Unlock()
}()
if input.InputThing {
mt.Lock()
}
defer mt.Unlock()
return &sdk.CapabilityResponse{
Response: &sdk.CapabilityResponse_Payload{Payload: payload},
}, nil
Expand Down
Loading