Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion network/network_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ import (
)

const defaultTimeout = 5 * time.Second

// reconnectTimeout is the budget for a node to reconnect to a peer by itself, after a connection that was up was
// closed cleanly. connect() then resets the backoff to a random value between 1 and 5 seconds, and the connect
// loop only picks up expired backoffs once per second on top of that, so defaultTimeout does not cover the worst
// case and the test fails intermittently under load.
const reconnectTimeout = 15 * time.Second
const payloadType = "test/transaction"

var mutex = sync.Mutex{}
Expand Down Expand Up @@ -828,7 +834,7 @@ func TestNetworkIntegration_OutboundConnection11Reconnects(t *testing.T) {
node2 = startNode(t, "node2", testDirectory) // important to start a new instance, otherwise PeerID isn't regenerated
if !test.WaitFor(t, func() (bool, error) {
return len(node1.network.connectionManager.Peers()) == 1, nil
}, defaultTimeout, "time-out while waiting for node 1 to reconnect to node 2") {
}, reconnectTimeout, "time-out while waiting for node 1 to reconnect to node 2") {
return
}

Expand Down
Loading