Commit 256ac64
committed
fix: eliminate port race in setupFakeEnvoyStats test helper
net.Listen(":0") followed by l.Close() and a later ListenAndServe() on
the resulting port number leaves a window where another process (or a
concurrently running test) can grab that exact ephemeral port before
the re-bind happens, causing TestGetTotalConnections to fail with
connection errors on loaded machines. Serve on the already-bound
listener directly via s.Serve(l) so the port is never released.
Signed-off-by: Muhammad Waqar <mwaqar@confluent.io>1 parent 8782e63 commit 256ac64
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
0 commit comments