mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
p2p: fix flaky test TestServerPortMapping
The test specifies `ListenAddr: ":0"`, which means a random ephemeral port will be chosen for the TCP listener by the OS. Additionally, since no `DiscAddr` was specified, the same port that is chosen automatically by the OS will also be used for the UDP listener in the discovery UDP setup. This sometimes leads to test failures if the TCP listener picks a free TCP port that is already taken for UDP. By specifying `DiscAddr: ":0"`, the UDP port will be chosen independently from the TCP port, fixing the random failure. See issue #29830.
This commit is contained in:
parent
b0f66e34ca
commit
b4e13404a3
1 changed files with 1 additions and 0 deletions
|
|
@ -36,6 +36,7 @@ func TestServerPortMapping(t *testing.T) {
|
||||||
PrivateKey: newkey(),
|
PrivateKey: newkey(),
|
||||||
NoDial: true,
|
NoDial: true,
|
||||||
ListenAddr: ":0",
|
ListenAddr: ":0",
|
||||||
|
DiscAddr: ":0",
|
||||||
NAT: mockNAT,
|
NAT: mockNAT,
|
||||||
Logger: testlog.Logger(t, log.LvlTrace),
|
Logger: testlog.Logger(t, log.LvlTrace),
|
||||||
clock: clock,
|
clock: clock,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue