Move nonblocking AddSnowflake out of goroutine in sqs test

This fixes a race condition in tests where sometimes snowflake matching
happens before enough snowflakes get added to the heap.
This commit is contained in:
Cecylia Bocovich 2025-02-21 09:50:39 -05:00
parent 50bed1e67a
commit 80374c6d93
No known key found for this signature in database
GPG key ID: 009DE379FD9B7B90

View file

@ -140,8 +140,8 @@ func TestSQS(t *testing.T) {
mockSQSClient.EXPECT().ReceiveMessage(sqsHandlerContext, &sqsReceiveMessageInput).AnyTimes().DoAndReturn(
func(ctx context.Context, input *sqs.ReceiveMessageInput, optFns ...func(*sqs.Options)) (*sqs.ReceiveMessageOutput, error) {
snowflake := ipcCtx.AddSnowflake("fake", "", NATUnrestricted, 0)
go func(c C) {
snowflake := ipcCtx.AddSnowflake("fake", "", NATUnrestricted, 0)
<-snowflake.offerChannel
snowflake.answerChannel <- "fake answer"
}(c)