@@ -15,7 +15,6 @@ import (
1515 "github.com/ipfs/boxo/bitswap/server"
1616 testinstance "github.com/ipfs/boxo/bitswap/testinstance"
1717 tn "github.com/ipfs/boxo/bitswap/testnet"
18- mockrouting "github.com/ipfs/boxo/routing/mock"
1918 blocks "github.com/ipfs/go-block-format"
2019 cid "github.com/ipfs/go-cid"
2120 detectrace "github.com/ipfs/go-detect-race"
@@ -51,7 +50,7 @@ func addBlock(t *testing.T, ctx context.Context, inst testinstance.Instance, blk
5150const kNetworkDelay = 0 * time .Millisecond
5251
5352func TestClose (t * testing.T ) {
54- vnet := tn .VirtualNetwork (mockrouting . NewServer (), delay .Fixed (kNetworkDelay ))
53+ vnet := tn .VirtualNetwork (delay .Fixed (kNetworkDelay ))
5554 ig := testinstance .NewTestInstanceGenerator (vnet , nil , nil )
5655 defer ig .Close ()
5756 block := random .BlocksOfSize (1 , blockSize )[0 ]
@@ -65,14 +64,13 @@ func TestClose(t *testing.T) {
6564}
6665
6766func TestProviderForKeyButNetworkCannotFind (t * testing.T ) { // TODO revisit this
68- rs := mockrouting .NewServer ()
69- net := tn .VirtualNetwork (rs , delay .Fixed (kNetworkDelay ))
67+ net := tn .VirtualNetwork (delay .Fixed (kNetworkDelay ))
7068 ig := testinstance .NewTestInstanceGenerator (net , nil , nil )
7169 defer ig .Close ()
7270
7371 block := blocks .NewBlock ([]byte ("block" ))
7472 pinfo := p2ptestutil .RandTestBogusIdentityOrFatal (t )
75- err := rs .Client (pinfo ).Provide (context .Background (), block .Cid (), true ) // but not on network
73+ err := ig . Routing () .Client (pinfo ).Provide (context .Background (), block .Cid (), true ) // but not on network
7674 if err != nil {
7775 t .Fatal (err )
7876 }
@@ -90,7 +88,7 @@ func TestProviderForKeyButNetworkCannotFind(t *testing.T) { // TODO revisit this
9088}
9189
9290func TestGetBlockFromPeerAfterPeerAnnounces (t * testing.T ) {
93- net := tn .VirtualNetwork (mockrouting . NewServer (), delay .Fixed (kNetworkDelay ))
91+ net := tn .VirtualNetwork (delay .Fixed (kNetworkDelay ))
9492 block := blocks .NewBlock ([]byte ("block" ))
9593 ig := testinstance .NewTestInstanceGenerator (net , nil , nil )
9694 defer ig .Close ()
@@ -118,7 +116,7 @@ func TestGetBlockFromPeerAfterPeerAnnounces(t *testing.T) {
118116}
119117
120118func TestDoesNotProvideWhenConfiguredNotTo (t * testing.T ) {
121- net := tn .VirtualNetwork (mockrouting . NewServer (), delay .Fixed (kNetworkDelay ))
119+ net := tn .VirtualNetwork (delay .Fixed (kNetworkDelay ))
122120 block := blocks .NewBlock ([]byte ("block" ))
123121 bsOpts := []bitswap.Option {bitswap .ProviderSearchDelay (50 * time .Millisecond )}
124122 ig := testinstance .NewTestInstanceGenerator (net , nil , bsOpts )
@@ -150,7 +148,7 @@ func TestDoesNotProvideWhenConfiguredNotTo(t *testing.T) {
150148// Tests that a received block is not stored in the blockstore if the block was
151149// not requested by the client
152150func TestUnwantedBlockNotAdded (t * testing.T ) {
153- net := tn .VirtualNetwork (mockrouting . NewServer (), delay .Fixed (kNetworkDelay ))
151+ net := tn .VirtualNetwork (delay .Fixed (kNetworkDelay ))
154152 block := blocks .NewBlock ([]byte ("block" ))
155153 bsMessage := bsmsg .New (true )
156154 bsMessage .AddBlock (block )
@@ -186,7 +184,7 @@ func TestUnwantedBlockNotAdded(t *testing.T) {
186184// (because the live request queue is full)
187185func TestPendingBlockAdded (t * testing.T ) {
188186 ctx := context .Background ()
189- net := tn .VirtualNetwork (mockrouting . NewServer (), delay .Fixed (kNetworkDelay ))
187+ net := tn .VirtualNetwork (delay .Fixed (kNetworkDelay ))
190188 sessionBroadcastWantCapacity := 4
191189
192190 ig := testinstance .NewTestInstanceGenerator (net , nil , nil )
@@ -277,7 +275,7 @@ func PerformDistributionTest(t *testing.T, numInstances, numBlocks int) {
277275 if testing .Short () {
278276 t .SkipNow ()
279277 }
280- net := tn .VirtualNetwork (mockrouting . NewServer (), delay .Fixed (kNetworkDelay ))
278+ net := tn .VirtualNetwork (delay .Fixed (kNetworkDelay ))
281279 ig := testinstance .NewTestInstanceGenerator (net , nil , []bitswap.Option {
282280 bitswap .TaskWorkerCount (5 ),
283281 bitswap .EngineTaskWorkerCount (5 ),
@@ -333,7 +331,7 @@ func TestSendToWantingPeer(t *testing.T) {
333331 t .SkipNow ()
334332 }
335333
336- net := tn .VirtualNetwork (mockrouting . NewServer (), delay .Fixed (kNetworkDelay ))
334+ net := tn .VirtualNetwork (delay .Fixed (kNetworkDelay ))
337335 ig := testinstance .NewTestInstanceGenerator (net , nil , nil )
338336 defer ig .Close ()
339337
@@ -370,7 +368,7 @@ func TestSendToWantingPeer(t *testing.T) {
370368}
371369
372370func TestEmptyKey (t * testing.T ) {
373- net := tn .VirtualNetwork (mockrouting . NewServer (), delay .Fixed (kNetworkDelay ))
371+ net := tn .VirtualNetwork (delay .Fixed (kNetworkDelay ))
374372 ig := testinstance .NewTestInstanceGenerator (net , nil , nil )
375373 defer ig .Close ()
376374 bs := ig .Instances (1 )[0 ].Exchange
@@ -403,7 +401,7 @@ func assertStat(t *testing.T, st *bitswap.Stat, sblks, rblks, sdata, rdata uint6
403401}
404402
405403func TestBasicBitswap (t * testing.T ) {
406- net := tn .VirtualNetwork (mockrouting . NewServer (), delay .Fixed (kNetworkDelay ))
404+ net := tn .VirtualNetwork (delay .Fixed (kNetworkDelay ))
407405 ig := testinstance .NewTestInstanceGenerator (net , nil , nil )
408406 defer ig .Close ()
409407
@@ -474,7 +472,7 @@ func TestBasicBitswap(t *testing.T) {
474472}
475473
476474func TestDoubleGet (t * testing.T ) {
477- net := tn .VirtualNetwork (mockrouting . NewServer (), delay .Fixed (kNetworkDelay ))
475+ net := tn .VirtualNetwork (delay .Fixed (kNetworkDelay ))
478476 ig := testinstance .NewTestInstanceGenerator (net , nil , nil )
479477 defer ig .Close ()
480478
@@ -538,7 +536,7 @@ func TestDoubleGet(t *testing.T) {
538536}
539537
540538func TestWantlistCleanup (t * testing.T ) {
541- net := tn .VirtualNetwork (mockrouting . NewServer (), delay .Fixed (kNetworkDelay ))
539+ net := tn .VirtualNetwork (delay .Fixed (kNetworkDelay ))
542540 ig := testinstance .NewTestInstanceGenerator (net , nil , nil )
543541 defer ig .Close ()
544542
@@ -659,7 +657,7 @@ func newReceipt(sent, recv, exchanged uint64) *server.Receipt {
659657}
660658
661659func TestBitswapLedgerOneWay (t * testing.T ) {
662- net := tn .VirtualNetwork (mockrouting . NewServer (), delay .Fixed (kNetworkDelay ))
660+ net := tn .VirtualNetwork (delay .Fixed (kNetworkDelay ))
663661 ig := testinstance .NewTestInstanceGenerator (net , nil , nil )
664662 defer ig .Close ()
665663
@@ -707,7 +705,7 @@ func TestBitswapLedgerOneWay(t *testing.T) {
707705}
708706
709707func TestBitswapLedgerTwoWay (t * testing.T ) {
710- net := tn .VirtualNetwork (mockrouting . NewServer (), delay .Fixed (kNetworkDelay ))
708+ net := tn .VirtualNetwork (delay .Fixed (kNetworkDelay ))
711709 ig := testinstance .NewTestInstanceGenerator (net , nil , nil )
712710 defer ig .Close ()
713711
@@ -795,7 +793,7 @@ func (tsl *testingScoreLedger) Stop() {
795793// Tests start and stop of a custom decision logic
796794func TestWithScoreLedger (t * testing.T ) {
797795 tsl := newTestingScoreLedger ()
798- net := tn .VirtualNetwork (mockrouting . NewServer (), delay .Fixed (kNetworkDelay ))
796+ net := tn .VirtualNetwork (delay .Fixed (kNetworkDelay ))
799797 bsOpts := []bitswap.Option {bitswap .WithScoreLedger (tsl )}
800798 ig := testinstance .NewTestInstanceGenerator (net , nil , bsOpts )
801799 defer ig .Close ()
0 commit comments