Browse Source

identify: Bump timeouts/sleep in tests (#2135)

* identify: Bump timeouts/sleep in tests

* Update p2p/protocol/identify/id.go

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
marco/fix-flaky-noalloc-test
Marco Munizaga 2 years ago
committed by GitHub
parent
commit
100ae2539b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      p2p/protocol/identify/id.go
  2. 2
      p2p/protocol/identify/id_test.go
  3. 4
      p2p/protocol/identify/obsaddr_test.go

1
p2p/protocol/identify/id.go

@ -350,6 +350,7 @@ func (ids *idService) IdentifyWait(c network.Conn) <-chan struct{} {
e, found := ids.conns[c]
if !found { // No entry found. Connection was most likely closed (and removed from this map) recently.
log.Debugw("connection not found in identify service", "peer", c.RemotePeer())
ch := make(chan struct{})
close(ch)
return ch

2
p2p/protocol/identify/id_test.go

@ -890,7 +890,7 @@ func TestIncomingIDStreamsTimeout(t *testing.T) {
}
}
return true
}, 1*time.Second, 200*time.Millisecond)
}, 5*time.Second, 200*time.Millisecond)
}
}

4
p2p/protocol/identify/obsaddr_test.go

@ -71,14 +71,14 @@ func (h *harness) connInbound(observer peer.ID) network.Conn {
func (h *harness) observe(observed ma.Multiaddr, observer peer.ID) network.Conn {
c := h.conn(observer)
h.oas.Record(c, observed)
time.Sleep(50 * time.Millisecond) // let the worker run
time.Sleep(200 * time.Millisecond) // let the worker run
return c
}
func (h *harness) observeInbound(observed ma.Multiaddr, observer peer.ID) network.Conn {
c := h.connInbound(observer)
h.oas.Record(c, observed)
time.Sleep(50 * time.Millisecond) // let the worker run
time.Sleep(200 * time.Millisecond) // let the worker run
return c
}

Loading…
Cancel
Save