@@ -16,9 +16,13 @@ import (
16
16
"testing"
17
17
"time"
18
18
19
+ testinstance "github.com/ipfs/boxo/bitswap/testinstance"
20
+ tn "github.com/ipfs/boxo/bitswap/testnet"
19
21
. "github.com/ipfs/boxo/ipld/merkledag"
20
22
mdpb "github.com/ipfs/boxo/ipld/merkledag/pb"
21
23
dstest "github.com/ipfs/boxo/ipld/merkledag/test"
24
+ mockrouting "github.com/ipfs/boxo/routing/mock"
25
+ delay "github.com/ipfs/go-ipfs-delay"
22
26
23
27
bserv "github.com/ipfs/boxo/blockservice"
24
28
bstest "github.com/ipfs/boxo/blockservice/test"
@@ -507,10 +511,12 @@ func TestCantGet(t *testing.T) {
507
511
}
508
512
509
513
func TestFetchGraph (t * testing.T ) {
510
- var dservs []ipld.DAGService
511
- bsis := bstest .Mocks (2 )
512
- for _ , bsi := range bsis {
513
- dservs = append (dservs , NewDAGService (bsi ))
514
+ net := tn .VirtualNetwork (mockrouting .NewServer (), delay .Fixed (0 ))
515
+ sg := testinstance .NewTestInstanceGenerator (net , nil , nil )
516
+ instances := sg .Instances (2 )
517
+ dservs := [2 ]ipld.DAGService {
518
+ NewDAGService (bserv .New (instances [0 ].Blockstore (), instances [0 ].Exchange )),
519
+ NewDAGService (bserv .New (instances [1 ].Blockstore (), instances [1 ].Exchange )),
514
520
}
515
521
516
522
read := io .LimitReader (u .NewTimeSeededRand (), 1024 * 32 )
@@ -522,7 +528,7 @@ func TestFetchGraph(t *testing.T) {
522
528
}
523
529
524
530
// create an offline dagstore and ensure all blocks were fetched
525
- bs := bserv .New (bsis [1 ].Blockstore (), offline . Exchange ( bsis [ 1 ]. Blockstore ()) )
531
+ bs := bserv .New (instances [1 ].Blockstore (), nil )
526
532
527
533
offlineDS := NewDAGService (bs )
528
534
@@ -547,10 +553,12 @@ func TestFetchGraphWithDepthLimit(t *testing.T) {
547
553
}
548
554
549
555
testF := func (t * testing.T , tc testcase ) {
550
- var dservs []ipld.DAGService
551
- bsis := bstest .Mocks (2 )
552
- for _ , bsi := range bsis {
553
- dservs = append (dservs , NewDAGService (bsi ))
556
+ net := tn .VirtualNetwork (mockrouting .NewServer (), delay .Fixed (0 ))
557
+ sg := testinstance .NewTestInstanceGenerator (net , nil , nil )
558
+ instances := sg .Instances (2 )
559
+ dservs := [2 ]ipld.DAGService {
560
+ NewDAGService (bserv .New (instances [0 ].Blockstore (), instances [0 ].Exchange )),
561
+ NewDAGService (bserv .New (instances [1 ].Blockstore (), instances [1 ].Exchange )),
554
562
}
555
563
556
564
root := makeDepthTestingGraph (t , dservs [0 ])
@@ -561,7 +569,7 @@ func TestFetchGraphWithDepthLimit(t *testing.T) {
561
569
}
562
570
563
571
// create an offline dagstore and ensure all blocks were fetched
564
- bs := bserv .New (bsis [1 ].Blockstore (), offline .Exchange (bsis [1 ].Blockstore ()))
572
+ bs := bserv .New (instances [1 ].Blockstore (), offline .Exchange (instances [1 ].Blockstore ()))
565
573
566
574
offlineDS := NewDAGService (bs )
567
575
0 commit comments