@cryptotaxi247 / kubo / commits / 193004a06

refac(bs/test) provide a shared net delay constant

License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

Brian Tiger Chow committed Dec 12, 2014 at 22:37 UTC 193004a0618711606b4fb52738406113addadddb
1 file changed +8 -6
exchange/bitswap/bitswap_test.go
+8 -6
@@ -15,10 +15,12 @@ import (
15 testutil "github.com/jbenet/go-ipfs/util/testutil"
16 )
17
18 +const kNetworkDelay = 0 * time.Millisecond
19 +
20 func TestClose(t *testing.T) {
21 // TODO
22 t.Skip("TODO Bitswap's Close implementation is a WIP")
21 - vnet := tn.VirtualNetwork(delay.Fixed(0))
23 + vnet := tn.VirtualNetwork(delay.Fixed(kNetworkDelay))
24 rout := mock.VirtualRoutingServer()
25 sesgen := NewSessionGenerator(vnet, rout)
26 bgen := blocksutil.NewBlockGenerator()
@@ -32,7 +34,7 @@ func TestClose(t *testing.T) {
34
35 func TestGetBlockTimeout(t *testing.T) {
36
35 - net := tn.VirtualNetwork(delay.Fixed(0))
37 + net := tn.VirtualNetwork(delay.Fixed(kNetworkDelay))
38 rs := mock.VirtualRoutingServer()
39 g := NewSessionGenerator(net, rs)
40
@@ -49,7 +51,7 @@ func TestGetBlockTimeout(t *testing.T) {
51
52 func TestProviderForKeyButNetworkCannotFind(t *testing.T) {
53
52 - net := tn.VirtualNetwork(delay.Fixed(0))
54 + net := tn.VirtualNetwork(delay.Fixed(kNetworkDelay))
55 rs := mock.VirtualRoutingServer()
56 g := NewSessionGenerator(net, rs)
57
@@ -70,7 +72,7 @@ func TestProviderForKeyButNetworkCannotFind(t *testing.T) {
72
73 func TestGetBlockFromPeerAfterPeerAnnounces(t *testing.T) {
74
73 - net := tn.VirtualNetwork(delay.Fixed(0))
75 + net := tn.VirtualNetwork(delay.Fixed(kNetworkDelay))
76 rs := mock.VirtualRoutingServer()
77 block := blocks.NewBlock([]byte("block"))
78 g := NewSessionGenerator(net, rs)
@@ -122,7 +124,7 @@ func PerformDistributionTest(t *testing.T, numInstances, numBlocks int) {
124 if testing.Short() {
125 t.SkipNow()
126 }
125 - net := tn.VirtualNetwork(delay.Fixed(0))
127 + net := tn.VirtualNetwork(delay.Fixed(kNetworkDelay))
128 rs := mock.VirtualRoutingServer()
129 sg := NewSessionGenerator(net, rs)
130 bg := blocksutil.NewBlockGenerator()
@@ -182,7 +184,7 @@ func TestSendToWantingPeer(t *testing.T) {
184 t.SkipNow()
185 }
186
185 - net := tn.VirtualNetwork(delay.Fixed(0))
187 + net := tn.VirtualNetwork(delay.Fixed(kNetworkDelay))
188 rs := mock.VirtualRoutingServer()
189 sg := NewSessionGenerator(net, rs)
190 bg := blocksutil.NewBlockGenerator()