diff --git a/internal/sessionmanager/sessionmanager_test.go b/internal/sessionmanager/sessionmanager_test.go index db88855f559e1c202fccad5cf1d13725128a5076..8025bd5fa27ff4f4e7fcaadde1a49056b0c04a30 100644 --- a/internal/sessionmanager/sessionmanager_test.go +++ b/internal/sessionmanager/sessionmanager_test.go @@ -2,6 +2,7 @@ package sessionmanager import ( "context" + "fmt" "sync" "testing" "time" @@ -118,7 +119,7 @@ func TestReceiveFrom(t *testing.T) { pm := &fakePeerManager{} sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "") - p := peer.ID(123) + p := peer.ID(fmt.Sprint(123)) block := blocks.NewBlock([]byte("block")) firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession) @@ -165,7 +166,7 @@ func TestReceiveBlocksWhenManagerShutdown(t *testing.T) { pm := &fakePeerManager{} sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "") - p := peer.ID(123) + p := peer.ID(fmt.Sprint(123)) block := blocks.NewBlock([]byte("block")) firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession) @@ -199,7 +200,7 @@ func TestReceiveBlocksWhenSessionContextCancelled(t *testing.T) { pm := &fakePeerManager{} sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "") - p := peer.ID(123) + p := peer.ID(fmt.Sprint(123)) block := blocks.NewBlock([]byte("block")) firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession) @@ -235,7 +236,7 @@ func TestShutdown(t *testing.T) { pm := &fakePeerManager{} sm := New(ctx, sessionFactory, sim, peerManagerFactory, bpm, pm, notif, "") - p := peer.ID(123) + p := peer.ID(fmt.Sprint(123)) block := blocks.NewBlock([]byte("block")) cids := []cid.Cid{block.Cid()} firstSession := sm.NewSession(ctx, time.Second, delay.Fixed(time.Minute)).(*fakeSession) diff --git a/internal/testutil/testutil.go b/internal/testutil/testutil.go index 48af8a7d8b18800bb861ad208cfd953289d32e41..6b9fc6f39dcff946e879507bee7bc35f44d401f4 100644 --- a/internal/testutil/testutil.go +++ b/internal/testutil/testutil.go @@ -1,6 +1,7 @@ package testutil import ( + "fmt" "math/rand" bsmsg "github.com/ipfs/go-bitswap/message" @@ -59,7 +60,7 @@ func GeneratePeers(n int) []peer.ID { peerIds := make([]peer.ID, 0, n) for i := 0; i < n; i++ { peerSeq++ - p := peer.ID(peerSeq) + p := peer.ID(fmt.Sprint(i)) peerIds = append(peerIds, p) } return peerIds