Commit 9ce03e9
committed
Fix flaky MetricsWebserver test by mocking TCP/Unix listener binding
The test was failing with 'Address already in use' because it was
calling add_tcp_listener() for real, which tried to bind to port 9395.
If the port was already in use (from a previous test or orphaned process),
the test would fail.
Solution: Mock add_tcp_listener and add_unix_listener in all test contexts
to prevent actual port binding. The mocks still verify the correct methods
are called with correct arguments, but don't perform real network operations.
This eliminates the EADDRINUSE flake without changing test coverage.1 parent d83d69e commit 9ce03e9
1 file changed
+3
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| 41 | + | |
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
| |||
0 commit comments