reset test to the way it ways before
@whyrusleeping License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
Brian Tiger Chow committed
Nov 23, 2014 at 22:59 UTC
d721c448af1770db259b7c274ac882bf921a2a60
1 file changed
+5
-8
blockservice/blocks_test.go
+5
-8
@@ -62,7 +62,7 @@ func TestBlocks(t *testing.T) {
62
}
63
}
64
65
-func TestGetBlocks(t *testing.T) {
65
+func TestGetBlocksSequential(t *testing.T) {
66
net := tn.VirtualNetwork()
67
rs := mock.VirtualRoutingServer()
68
sg := bitswap.NewSessionGenerator(net, rs)
@@ -87,14 +87,11 @@ func TestGetBlocks(t *testing.T) {
87
servs[0].AddBlock(blk)
88
}
89
90
- var chans []<-chan *blocks.Block
91
- for i := 1; i < 4; i++ {
92
- ctx, _ := context.WithTimeout(context.TODO(), time.Second*5)
93
- ch := servs[i].GetBlocks(ctx, keys)
94
- chans = append(chans, ch)
95
- }
90
+ t.Log("one instance at a time, get blocks concurrently")
91
97
- for _, out := range chans {
92
+ for i := 1; i < len(instances); i++ {
93
+ ctx, _ := context.WithTimeout(context.TODO(), time.Second*5)
94
+ out := servs[i].GetBlocks(ctx, keys)
95
gotten := make(map[u.Key]*blocks.Block)
96
for blk := range out {
97
if _, ok := gotten[blk.Key()]; ok {