Commit 4c25686a authored by Matthew Slipper's avatar Matthew Slipper Committed by GitHub

op-e2e: Fix flakiness in TestP2PFull (#12793)

The ConnectedF callback was sending to a channel that was only ever read from once. This causes the test to time out under certain conditions.
parent 1ebbd291
...@@ -6,6 +6,7 @@ import ( ...@@ -6,6 +6,7 @@ import (
"math/big" "math/big"
"net" "net"
"slices" "slices"
gosync "sync"
"testing" "testing"
"time" "time"
...@@ -126,9 +127,12 @@ func TestP2PFull(t *testing.T) { ...@@ -126,9 +127,12 @@ func TestP2PFull(t *testing.T) {
conns := make(chan network.Conn, 1) conns := make(chan network.Conn, 1)
hostA := nodeA.Host() hostA := nodeA.Host()
var once gosync.Once
hostA.Network().Notify(&network.NotifyBundle{ hostA.Network().Notify(&network.NotifyBundle{
ConnectedF: func(n network.Network, conn network.Conn) { ConnectedF: func(n network.Network, conn network.Conn) {
once.Do(func() {
conns <- conn conns <- conn
})
}}) }})
backend := NewP2PAPIBackend(nodeA, logA, nil) backend := NewP2PAPIBackend(nodeA, logA, nil)
......
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