@cryptotaxi247 / kubo / commits / d9a815b3a

p2p/net/swarm: nicer test timeouts for travis

Juan Batiz-Benet committed Jan 13, 2015 at 08:31 UTC d9a815b3a054bf341ca208c2b14a1c55f5790c0a
1 file changed +12
p2p/net/swarm/dial_test.go
+12
@@ -2,6 +2,7 @@ package swarm
2
3 import (
4 "net"
5 + "os"
6 "sync"
7 "testing"
8 "time"
@@ -113,6 +114,9 @@ func TestDialWait(t *testing.T) {
114 defer s1.Close()
115
116 s1.dialT = time.Millisecond * 300 // lower timeout for tests.
117 + if os.Getenv("TRAVIS") == "1" {
118 + s1.dialT = time.Second
119 + }
120
121 // dial to a non-existent peer.
122 s2p, s2addr, s2l := newSilentPeer(t)
@@ -144,6 +148,10 @@ func TestDialWait(t *testing.T) {
148
149 func TestDialBackoff(t *testing.T) {
150 // t.Skip("skipping for another test")
151 + if os.Getenv("TRAVIS") == "1" {
152 + t.Skip("travis will never have fun with this test")
153 + }
154 +
155 t.Parallel()
156
157 ctx := context.Background()
@@ -367,6 +375,10 @@ func TestDialBackoffClears(t *testing.T) {
375 defer s2.Close()
376 s1.dialT = time.Millisecond * 300 // lower timeout for tests.
377 s2.dialT = time.Millisecond * 300 // lower timeout for tests.
378 + if os.Getenv("TRAVIS") == "1" {
379 + s1.dialT = time.Second
380 + s2.dialT = time.Second
381 + }
382
383 // use another address first, that accept and hang on conns
384 _, s2bad, s2l := newSilentPeer(t)