- Notifications
You must be signed in to change notification settings - Fork926
Commit50575e1
authored
fix: use fake local network for port-forward tests (#11119)
Fixes#10979Testing code that listens on a specific port has created a long battle with flakes. Previous attempts to deal with this include opening a listener on a port chosen by the OS, then closing the listener, noting the port and starting the test with that port.This still flakes, notably in macOS which has a proclivity to reuse ports quickly.Instead of fighting with the chaos that is an OS networking stack, this PR fakes the host networking in tests.I've taken a small step here, only faking out the Listen() calls that port-forward makes, but I think over time we should be transitioning all networking the CLI does to an abstract interface so we can fake it. This allows us to run in parallel without flakes andpresents an opportunity to test error paths as well.1 parent37f6b38 commit50575e1
File tree
4 files changed
+191
-106
lines changed- cli
- clibase
4 files changed
+191
-106
lines changedLines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
189 | 189 |
| |
190 | 190 |
| |
191 | 191 |
| |
| 192 | + | |
192 | 193 |
| |
193 | 194 |
| |
194 | 195 |
| |
| |||
203 | 204 |
| |
204 | 205 |
| |
205 | 206 |
| |
| 207 | + | |
206 | 208 |
| |
207 | 209 |
| |
208 | 210 |
| |
|
Lines changed: 50 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + |
Lines changed: 7 additions & 29 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
15 |
| - | |
16 | 15 |
| |
17 | 16 |
| |
18 | 17 |
| |
| |||
121 | 120 |
| |
122 | 121 |
| |
123 | 122 |
| |
| 123 | + | |
124 | 124 |
| |
125 | 125 |
| |
126 | 126 |
| |
| |||
134 | 134 |
| |
135 | 135 |
| |
136 | 136 |
| |
| 137 | + | |
137 | 138 |
| |
138 | 139 |
| |
139 | 140 |
| |
| |||
151 | 152 |
| |
152 | 153 |
| |
153 | 154 |
| |
| 155 | + | |
154 | 156 |
| |
155 |
| - | |
| 157 | + | |
| 158 | + | |
156 | 159 |
| |
157 | 160 |
| |
158 | 161 |
| |
| |||
161 | 164 |
| |
162 | 165 |
| |
163 | 166 |
| |
| 167 | + | |
164 | 168 |
| |
165 | 169 |
| |
166 | 170 |
| |
| |||
198 | 202 |
| |
199 | 203 |
| |
200 | 204 |
| |
201 |
| - | |
202 |
| - | |
203 |
| - | |
204 |
| - | |
205 |
| - | |
206 |
| - | |
207 |
| - | |
208 |
| - | |
209 |
| - | |
210 |
| - | |
211 |
| - | |
212 |
| - | |
213 |
| - | |
214 |
| - | |
215 |
| - | |
216 |
| - | |
217 |
| - | |
218 |
| - | |
219 |
| - | |
220 |
| - | |
221 |
| - | |
222 |
| - | |
223 |
| - | |
224 |
| - | |
225 |
| - | |
226 |
| - | |
227 |
| - | |
| 205 | + | |
228 | 206 |
| |
229 | 207 |
| |
230 | 208 |
| |
|
0 commit comments
Comments
(0)