Skip to content

Commit fbee7a6

Browse files
committed
fix test race
1 parent 6d318f5 commit fbee7a6

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

pkg/workflows/wasm/host/execution_semaphore_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,12 @@ func TestSemaphore_SlotsRecycledCorrectly(t *testing.T) {
202202
}
203203

204204
// After all rounds, all slots should be available again.
205-
avail, err := exec.pendingCallsLimiter.Available(ctx)
206-
require.NoError(t, err)
207-
assert.Equal(t, max, avail,
205+
// Goroutines release slots via defer after the channel send, so allow a
206+
// brief window for the last batch of defers to execute.
207+
assert.Eventually(t, func() bool {
208+
avail, err := exec.pendingCallsLimiter.Available(ctx)
209+
return err == nil && avail == max
210+
}, time.Second, 5*time.Millisecond,
208211
"limiter still has occupied slots after all awaits completed")
209212
}
210213

0 commit comments

Comments
 (0)