Skip to content

Commit

Permalink
In get-latest tests wait a bit after connecting hosts so they have ti…
Browse files Browse the repository at this point in the history
…me to connect.
  • Loading branch information
aschmahmann committed Aug 9, 2019
1 parent 3bf24fa commit e9b0864
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions getlatest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"errors"
"testing"
"time"

"github.com/libp2p/go-libp2p-core/host"
)
Expand Down Expand Up @@ -36,6 +37,9 @@ func TestGetLatestProtocolTrip(t *testing.T) {
hosts := newNetHosts(ctx, t, 2)
connect(t, hosts[0], hosts[1])

// wait for hosts to get connected
time.Sleep(time.Millisecond * 100)

d1 := &datastore{map[string][]byte{"key": []byte("value1")}}
h1 := newGetLatestProtocol(hosts[0], d1.Lookup)

Expand All @@ -53,6 +57,9 @@ func TestGetLatestProtocolNil(t *testing.T) {
hosts := newNetHosts(ctx, t, 2)
connect(t, hosts[0], hosts[1])

// wait for hosts to get connected
time.Sleep(time.Millisecond * 100)

d1 := &datastore{map[string][]byte{"key": []byte("value1")}}
h1 := newGetLatestProtocol(hosts[0], d1.Lookup)

Expand All @@ -70,6 +77,9 @@ func TestGetLatestProtocolRepeated(t *testing.T) {
hosts := newNetHosts(ctx, t, 2)
connect(t, hosts[0], hosts[1])

// wait for hosts to get connected
time.Sleep(time.Millisecond * 100)

d1 := &datastore{map[string][]byte{"key": []byte("value1")}}
h1 := newGetLatestProtocol(hosts[0], d1.Lookup)

Expand Down

0 comments on commit e9b0864

Please sign in to comment.