Commit 0d90ccc
[analysis_server] Use unique request IDs in tests to avoid flaky tests
Some of the LSP-over-Legacy tests were intermittently failing because the test did not correctly wait for the `setClientCapabilities` request to complete.
The reason for this was that it used the ID `0` (from `_newRequestId`) but so did `setAnalysisRoots`. If the timing was right, the second request would appear to complete when the first did (because the response had id=0) and the test would start before the capabilities had actually been set (and since the test reads them directly off the server, they would be incorrect).
This moves the `_nextRequestId` field down into a base class and updates the helpers for requests like `setAnalysisRoots` to use it too.
Change-Id: Ice44191aad39c7ea81c40e501827557fe563e3d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/405760
Reviewed-by: Brian Wilkerson <[email protected]>
Reviewed-by: Konstantin Shcheglov <[email protected]>
Commit-Queue: Brian Wilkerson <[email protected]>1 parent 4fce27b commit 0d90ccc
File tree
2 files changed
+28
-17
lines changed- pkg/analysis_server/test
- lsp_over_legacy
2 files changed
+28
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
| |||
148 | 151 | | |
149 | 152 | | |
150 | 153 | | |
151 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
152 | 158 | | |
153 | 159 | | |
154 | 160 | | |
155 | 161 | | |
156 | 162 | | |
157 | 163 | | |
158 | 164 | | |
159 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
160 | 169 | | |
161 | 170 | | |
162 | 171 | | |
| |||
171 | 180 | | |
172 | 181 | | |
173 | 182 | | |
174 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
175 | 187 | | |
176 | 188 | | |
177 | 189 | | |
| |||
214 | 226 | | |
215 | 227 | | |
216 | 228 | | |
217 | | - | |
218 | | - | |
219 | | - | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
220 | 233 | | |
221 | 234 | | |
222 | 235 | | |
| |||
264 | 277 | | |
265 | 278 | | |
266 | 279 | | |
267 | | - | |
268 | | - | |
269 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
270 | 284 | | |
271 | 285 | | |
272 | 286 | | |
| |||
Lines changed: 5 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | 153 | | |
157 | 154 | | |
158 | 155 | | |
| |||
207 | 204 | | |
208 | 205 | | |
209 | 206 | | |
210 | | - | |
| 207 | + | |
211 | 208 | | |
212 | 209 | | |
213 | 210 | | |
| |||
241 | 238 | | |
242 | 239 | | |
243 | 240 | | |
244 | | - | |
| 241 | + | |
245 | 242 | | |
246 | 243 | | |
247 | 244 | | |
| |||
323 | 320 | | |
324 | 321 | | |
325 | 322 | | |
326 | | - | |
| 323 | + | |
327 | 324 | | |
328 | 325 | | |
329 | 326 | | |
| |||
341 | 338 | | |
342 | 339 | | |
343 | 340 | | |
344 | | - | |
| 341 | + | |
345 | 342 | | |
346 | 343 | | |
347 | 344 | | |
| |||
377 | 374 | | |
378 | 375 | | |
379 | 376 | | |
380 | | - | |
| 377 | + | |
381 | 378 | | |
382 | 379 | | |
383 | 380 | | |
| |||
0 commit comments