From ffd613a5fc4f26f77abb34037f1018b5a816bc12 Mon Sep 17 00:00:00 2001 From: mcrakhman Date: Wed, 28 Jun 2023 11:59:13 +0200 Subject: [PATCH] Fix requestmanager test --- commonspace/requestmanager/requestmanager_test.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/commonspace/requestmanager/requestmanager_test.go b/commonspace/requestmanager/requestmanager_test.go index 35d497fc..68c0e78c 100644 --- a/commonspace/requestmanager/requestmanager_test.go +++ b/commonspace/requestmanager/requestmanager_test.go @@ -2,6 +2,10 @@ package requestmanager import ( "context" + "sync" + "testing" + "time" + "github.com/anyproto/any-sync/commonspace/objectsync" "github.com/anyproto/any-sync/commonspace/objectsync/mock_objectsync" "github.com/anyproto/any-sync/commonspace/spacesyncproto" @@ -13,9 +17,6 @@ import ( "github.com/stretchr/testify/require" "storj.io/drpc" "storj.io/drpc/drpcconn" - "sync" - "testing" - "time" ) type fixture struct { @@ -146,6 +147,7 @@ func TestRequestManager_QueueRequest(t *testing.T) { _, ok = msgs.Load("otherId1") require.True(t, ok) close(msgRelease) + fx.requestManager.Close(context.Background()) }) t.Run("no requests after close", func(t *testing.T) { @@ -181,9 +183,9 @@ func TestRequestManager_QueueRequest(t *testing.T) { close(msgRelease) // waiting to know if the second one is not taken // because the manager is now closed - time.Sleep(100 * time.Millisecond) + time.Sleep(200 * time.Millisecond) _, ok = msgs.Load("id2") require.False(t, ok) - + fx.requestManager.Close(context.Background()) }) }