From 7678ab885093ab6b8b533fa24418c9ee8db1d0fe Mon Sep 17 00:00:00 2001 From: Sam Kleinman Date: Wed, 6 Apr 2022 17:50:14 -0400 Subject: [PATCH] statesync: tweak test performance (#8267) --- internal/statesync/reactor_test.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/statesync/reactor_test.go b/internal/statesync/reactor_test.go index f59a6e4ee..cef0735f2 100644 --- a/internal/statesync/reactor_test.go +++ b/internal/statesync/reactor_test.go @@ -196,11 +196,11 @@ func setup( } func TestReactor_Sync(t *testing.T) { - ctx, cancel := context.WithCancel(context.Background()) + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) defer cancel() const snapshotHeight = 7 - rts := setup(ctx, t, nil, nil, 2) + rts := setup(ctx, t, nil, nil, 100) chain := buildLightBlockChain(ctx, t, 1, 10, time.Now()) // app accepts any snapshot rts.conn.On("OfferSnapshot", ctx, mock.AnythingOfType("types.RequestOfferSnapshot")). @@ -224,8 +224,7 @@ func TestReactor_Sync(t *testing.T) { closeCh := make(chan struct{}) defer close(closeCh) - go handleLightBlockRequests(ctx, t, chain, rts.blockOutCh, - rts.blockInCh, closeCh, 0) + go handleLightBlockRequests(ctx, t, chain, rts.blockOutCh, rts.blockInCh, closeCh, 0) go graduallyAddPeers(ctx, t, rts.peerUpdateCh, closeCh, 1*time.Second) go handleSnapshotRequests(ctx, t, rts.snapshotOutCh, rts.snapshotInCh, closeCh, []snapshot{ {