Commit 047e0ca
fix: replace infinite loops with bounded polling in p2p switch tests (#2800)
## Summary
- Replace unbounded `for` loops in
`TestPeerRemovedFromReactorOnStopWithNilReason` and
`TestSwitchInitPeerIsNotCalledBeforeRemovePeer` with
`require.Eventually` calls that timeout after 5 seconds
- The infinite loops could hang forever if the peer was never added to
the switch, causing the test to hit the 15-minute CI timeout
Closes #2791
## Test plan
- [x] `go test -v -run
"TestSwitchInitPeerIsNotCalledBeforeRemovePeer|TestPeerRemovedFromReactorOnStopWithNilReason"
-count=1 -timeout=30s ./p2p/` passes locally
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 60fc8c8 commit 047e0ca
1 file changed
+8
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
823 | 823 | | |
824 | 824 | | |
825 | 825 | | |
826 | | - | |
827 | | - | |
| 826 | + | |
828 | 827 | | |
829 | 828 | | |
830 | | - | |
| 829 | + | |
831 | 830 | | |
832 | | - | |
| 831 | + | |
| 832 | + | |
833 | 833 | | |
834 | 834 | | |
835 | 835 | | |
| |||
872 | 872 | | |
873 | 873 | | |
874 | 874 | | |
875 | | - | |
876 | | - | |
877 | | - | |
878 | | - | |
879 | | - | |
880 | | - | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
881 | 879 | | |
882 | 880 | | |
883 | 881 | | |
| |||
0 commit comments