p2p/simulations: fix staticcheck warnings (#20322)

This commit is contained in:
Felix Lange
2019-11-19 17:16:42 +01:00
committed by GitHub
parent 9e8cc00b73
commit df206d2513
5 changed files with 128 additions and 190 deletions

View File

@ -81,11 +81,13 @@ func TestSnapshot(t *testing.T) {
// connect nodes in a ring
// spawn separate thread to avoid deadlock in the event listeners
connectErr := make(chan error, 1)
go func() {
for i, id := range ids {
peerID := ids[(i+1)%len(ids)]
if err := network.Connect(id, peerID); err != nil {
t.Fatal(err)
connectErr <- err
return
}
}
}()
@ -100,9 +102,10 @@ OUTER:
select {
case <-ctx.Done():
t.Fatal(ctx.Err())
case err := <-connectErr:
t.Fatal(err)
case ev := <-evC:
if ev.Type == EventTypeConn && !ev.Control {
// fail on any disconnect
if !ev.Conn.Up {
t.Fatalf("unexpected disconnect: %v -> %v", ev.Conn.One, ev.Conn.Other)