From 532e566e8a5913f485afe5ed90e7192e8cc0f814 Mon Sep 17 00:00:00 2001 From: ross Date: Wed, 11 May 2022 16:08:32 +1000 Subject: [PATCH] remove raciness from test --- aw_test.go | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/aw_test.go b/aw_test.go index 6e84f8e..99c1b00 100644 --- a/aw_test.go +++ b/aw_test.go @@ -372,18 +372,13 @@ var _ = Describe("Peer", func() { peer2.ContentResolver.InsertContent(successID, []byte("content")) for i := 0; i < int(opts.MaxPendingSyncs); i++ { - i := i - go func() { - contentID := []byte(fmt.Sprintf("%v", i)) - syncCtx, syncCancel := context.WithTimeout(ctx, 100*time.Millisecond) - peer1.Sync(syncCtx, contentID, nil) - syncCancel() - }() + contentID := []byte(fmt.Sprintf("%v", i)) + syncCtx, syncCancel := context.WithTimeout(ctx, 1*time.Millisecond) + peer1.Sync(syncCtx, contentID, nil) + syncCancel() } - time.Sleep(100 * time.Millisecond) - - syncCtx, syncCancel := context.WithTimeout(ctx, 100*time.Millisecond) + syncCtx, syncCancel := context.WithTimeout(ctx, 10*time.Millisecond) _, err := peer1.Sync(syncCtx, successID, nil) syncCancel()