Skip to content

Commit

Permalink
identify: Bump timeouts/sleep in tests (#2135)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
MarcoPolo and marten-seemann committed Feb 24, 2023
1 parent 7043217 commit 100ae25
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions p2p/protocol/identify/id.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion p2p/protocol/identify/id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ func TestIncomingIDStreamsTimeout(t *testing.T) {
}
}
return true
}, 1*time.Second, 200*time.Millisecond)
}, 5*time.Second, 200*time.Millisecond)
}
}

Expand Down
4 changes: 2 additions & 2 deletions p2p/protocol/identify/obsaddr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 100ae25

Please sign in to comment.