From 8e44630dba116b295e5a4a4ca321a2b4ed230bba Mon Sep 17 00:00:00 2001 From: Aarsh Shah Date: Wed, 2 Sep 2020 09:57:11 +0530 Subject: [PATCH] fix test and lint --- retrievalmarket/impl/integration_test.go | 3 ++- storagemarket/network/libp2p_impl_test.go | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/retrievalmarket/impl/integration_test.go b/retrievalmarket/impl/integration_test.go index bcb7d515..7ccf7022 100644 --- a/retrievalmarket/impl/integration_test.go +++ b/retrievalmarket/impl/integration_test.go @@ -74,7 +74,8 @@ func TestProvider_Stop(t *testing.T) { client, expectedCIDs, _, _, retrievalPeer, provider := requireSetupTestClientAndProvider(bgCtx, t, payChAddr) require.NoError(t, provider.Stop()) _, err := client.Query(bgCtx, retrievalPeer, expectedCIDs[0], retrievalmarket.QueryParams{}) - assert.EqualError(t, err, "protocol not supported") + + assert.EqualError(t, err, "exhausted 5 attempts but failed to open stream, err: protocol not supported") } func requireSetupTestClientAndProvider(bgCtx context.Context, t *testing.T, payChAddr address.Address) (retrievalmarket.RetrievalClient, diff --git a/storagemarket/network/libp2p_impl_test.go b/storagemarket/network/libp2p_impl_test.go index 2965eba2..32806741 100644 --- a/storagemarket/network/libp2p_impl_test.go +++ b/storagemarket/network/libp2p_impl_test.go @@ -63,10 +63,13 @@ func TestOpenStreamWithRetries(t *testing.T) { require.NoError(t, err) achan <- readq }} + + var err error + go func() { select { - case _ = <-time.After(3 * time.Second): - toNetwork.SetDelegate(tr2) + case <-time.After(3 * time.Second): + err = toNetwork.SetDelegate(tr2) case <-ctx.Done(): return } @@ -74,6 +77,7 @@ func TestOpenStreamWithRetries(t *testing.T) { // setup query stream host1 --> host 2 assertAskRequestReceived(ctx, t, fromNetwork, toHost, achan) + assert.NoError(t, err) } func TestAskStreamSendReceiveAskRequest(t *testing.T) {