Commit 3104b2da authored by hannahhoward's avatar hannahhoward

fix(sessions): fix data race in test

parent 49a96fbe
......@@ -2,7 +2,6 @@ package session
import (
"context"
"fmt"
"math/rand"
"time"
......@@ -341,7 +340,6 @@ func (s *Session) handleTick(ctx context.Context) {
}
func (s *Session) handleRebroadcast(ctx context.Context) {
fmt.Println("Rebroadcast")
if len(s.liveWants) == 0 {
return
......
......@@ -260,8 +260,12 @@ func TestSessionFindMorePeers(t *testing.T) {
}
func TestSessionFailingToGetFirstBlock(t *testing.T) {
SetProviderSearchDelay(10 * time.Millisecond)
defer SetProviderSearchDelay(1 * time.Second)
SetRebroadcastDelay(delay.Fixed(100 * time.Millisecond))
defer SetRebroadcastDelay(delay.Fixed(1 * time.Minute))
ctx, cancel := context.WithTimeout(context.Background(), 900*time.Millisecond)
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
wantReqs := make(chan wantReq, 1)
cancelReqs := make(chan wantReq, 1)
......@@ -269,10 +273,7 @@ func TestSessionFailingToGetFirstBlock(t *testing.T) {
fpm := &fakePeerManager{findMorePeersRequested: make(chan cid.Cid, 1)}
frs := &fakeRequestSplitter{}
id := testutil.GenerateSessionID()
SetProviderSearchDelay(10 * time.Millisecond)
defer SetProviderSearchDelay(1 * time.Second)
SetRebroadcastDelay(delay.Fixed(100 * time.Millisecond))
defer SetRebroadcastDelay(delay.Fixed(1 * time.Minute))
session := New(ctx, id, fwm, fpm, frs)
blockGenerator := blocksutil.NewBlockGenerator()
blks := blockGenerator.Blocks(4)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment