From 4780c65171ac4bf84bf7baa7de1eca328321ca3c Mon Sep 17 00:00:00 2001 From: Jeromy Date: Fri, 17 Jul 2015 17:28:44 -0700 Subject: [PATCH 1/2] mark other nodes in routing table on test-connect License: MIT Signed-off-by: Jeromy --- routing/dht/dht_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/routing/dht/dht_test.go b/routing/dht/dht_test.go index 1358903a9..6baedfbd1 100644 --- a/routing/dht/dht_test.go +++ b/routing/dht/dht_test.go @@ -78,6 +78,14 @@ func connect(t *testing.T, ctx context.Context, a, b *IpfsDHT) { if err := a.host.Connect(ctx, pi); err != nil { t.Fatal(err) } + + for a.routingTable.Find(b.self) == "" { + time.Sleep(time.Millisecond * 5) + } + + for b.routingTable.Find(a.self) == "" { + time.Sleep(time.Millisecond * 5) + } } func bootstrap(t *testing.T, ctx context.Context, dhts []*IpfsDHT) { From 6564fae65c54b942714ea69c1521071c9a4bd8ed Mon Sep 17 00:00:00 2001 From: Jeromy Date: Sun, 19 Jul 2015 16:32:50 -0700 Subject: [PATCH 2/2] comment for future @jbenet and @whyrusleeping's to understand reasoning License: MIT Signed-off-by: Jeromy --- routing/dht/dht_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/routing/dht/dht_test.go b/routing/dht/dht_test.go index 6baedfbd1..2e63e438e 100644 --- a/routing/dht/dht_test.go +++ b/routing/dht/dht_test.go @@ -79,6 +79,8 @@ func connect(t *testing.T, ctx context.Context, a, b *IpfsDHT) { t.Fatal(err) } + // loop until connection notification has been received. + // under high load, this may not happen as immediately as we would like. for a.routingTable.Find(b.self) == "" { time.Sleep(time.Millisecond * 5) }