Skip to content

Commit 6f97eb2

Browse files
DanTupCommit Queue
authored and
Commit Queue
committed
[anlaysis_server] Fix flaky verify_sorted test
This test appears to have been flaky for a while. Sometimes the analysis status triggers multiple times during the test run which results in "Future already completed" errors. It's not clear why the status fires multiple times (I cannot reproduce it locally despite running in a loop for a while) but the test really only cares about detecting that initial analysis has completed, so I've changed it only track the first instance. Change-Id: If8e5d5b3ba27217bbdce94a68840882773920351 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347020 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]>
1 parent 8db4393 commit 6f97eb2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pkg/analysis_server_client/test/verify_sorted_test.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ Future<Server> connectToServer(String packagePath) async {
7575
await server.send(ANALYSIS_REQUEST_SET_ANALYSIS_ROOTS,
7676
AnalysisSetAnalysisRootsParams([packagePath], const []).toJson());
7777

78-
// wait for analysis to complete
79-
await handler.analysisFinished.future;
78+
// wait for initial analysis to complete
79+
await handler.initialAnalysis.future;
8080

8181
return server;
8282
}
@@ -108,15 +108,15 @@ class StatusHandler with NotificationHandler, ConnectionHandler {
108108
@override
109109
final Server server;
110110

111-
final Completer<bool> analysisFinished = Completer();
111+
final Completer<bool> initialAnalysis = Completer();
112112

113113
StatusHandler(this.server);
114114

115115
@override
116116
void onServerStatus(ServerStatusParams params) {
117117
if (params.analysis != null) {
118-
if (!params.analysis!.isAnalyzing) {
119-
analysisFinished.complete(true);
118+
if (!params.analysis!.isAnalyzing && !initialAnalysis.isCompleted) {
119+
initialAnalysis.complete(true);
120120
}
121121
}
122122
}

0 commit comments

Comments
 (0)