Commit ce367ee7 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

ext_test: bitten by mocknet ordering

mocknet indeterminism screwed this test up. that's twice
it's bitten us. let's not let it do it a third time.

cc @briantigerchow omg.
parent b4be7c59
......@@ -32,11 +32,10 @@ func TestGetFailures(t *testing.T) {
t.Fatal(err)
}
hosts := mn.Hosts()
peers := mn.Peers()
tsds := dssync.MutexWrap(ds.NewMapDatastore())
d := NewDHT(ctx, hosts[0], tsds)
d.Update(ctx, peers[1])
d.Update(ctx, hosts[1].ID())
// u.POut("NotFound Test\n")
// Reply with failures to every message
......@@ -147,12 +146,11 @@ func TestNotFound(t *testing.T) {
t.Fatal(err)
}
hosts := mn.Hosts()
peers := mn.Peers()
tsds := dssync.MutexWrap(ds.NewMapDatastore())
d := NewDHT(ctx, hosts[0], tsds)
for _, p := range peers {
d.Update(ctx, p)
for _, p := range hosts {
d.Update(ctx, p.ID())
}
// Reply with random peers to every message
......@@ -175,7 +173,7 @@ func TestNotFound(t *testing.T) {
ps := []peer.PeerInfo{}
for i := 0; i < 7; i++ {
p := peers[rand.Intn(len(peers))]
p := hosts[rand.Intn(len(hosts))].ID()
pi := host.Peerstore().PeerInfo(p)
ps = append(ps, pi)
}
......@@ -220,13 +218,12 @@ func TestLessThanKResponses(t *testing.T) {
t.Fatal(err)
}
hosts := mn.Hosts()
peers := mn.Peers()
tsds := dssync.MutexWrap(ds.NewMapDatastore())
d := NewDHT(ctx, hosts[0], tsds)
for i := 1; i < 5; i++ {
d.Update(ctx, peers[i])
d.Update(ctx, hosts[i].ID())
}
// Reply with random peers to every message
......@@ -245,7 +242,7 @@ func TestLessThanKResponses(t *testing.T) {
switch pmes.GetType() {
case pb.Message_GET_VALUE:
pi := host.Peerstore().PeerInfo(peers[1])
pi := host.Peerstore().PeerInfo(hosts[1].ID())
resp := &pb.Message{
Type: pmes.Type,
CloserPeers: pb.PeerInfosToPBPeers(d.host.Network(), []peer.PeerInfo{pi}),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment