From 33765fe7910224536e4092ebc70056225fe3a1e8 Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 17 Sep 2025 15:01:51 -0400 Subject: [PATCH 1/2] Fix a bug in the CRE SDK standard test verifying calls are async, it allowed the first request to respond before the second was made --- pkg/workflows/wasm/host/standard_test.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkg/workflows/wasm/host/standard_test.go b/pkg/workflows/wasm/host/standard_test.go index 69cf8a6ee..004d7d9dd 100644 --- a/pkg/workflows/wasm/host/standard_test.go +++ b/pkg/workflows/wasm/host/standard_test.go @@ -98,12 +98,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 From 12eddf63f01b1ce68aeb89d1d4a03ab59cc8a76f Mon Sep 17 00:00:00 2001 From: Ryan Tinianov Date: Wed, 17 Sep 2025 15:18:47 -0400 Subject: [PATCH 2/2] Add comment --- pkg/workflows/wasm/host/standard_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/workflows/wasm/host/standard_test.go b/pkg/workflows/wasm/host/standard_test.go index 004d7d9dd..253864273 100644 --- a/pkg/workflows/wasm/host/standard_test.go +++ b/pkg/workflows/wasm/host/standard_test.go @@ -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")