[analysis_server] Try to deflake will_rename_files test

Can't repro the failure locally this time, but my feeling is that maybe the overlay is being applied before the refactor starts. This adds pumpEventQueue to allow the refactor to start before sending the overlay change.

Change-Id: I8078b4cfe000d4155b965a384dbf116ef176fd48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332208
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Danny Tuppeny 2023-10-26 18:34:32 +00:00 committed by Commit Queue
parent 49ef0be2bc
commit 6299529e39

View file

@ -60,8 +60,15 @@ class WillRenameFilesTest extends LspOverLegacyTest {
newUri: toUri(testFileNewPath).toString(),
),
]);
// Allow the refactor time to start before sending the update. We know the
// refactor won't complete because it's waiting for the future we control.
await pumpEventQueue(times: 5000);
await updateOverlay(testFilePath, SourceEdit(0, 0, 'inserted'));
await pumpEventQueue(times: 50000).then(completer.complete);
// Allow time for the overlay to be applied and analyzed before allowing
// the refactor to continue.
await pumpEventQueue(times: 5000);
completer.complete();
expect(editFuture, throwsA(isResponseError(ErrorCodes.ContentModified)));
} finally {