Skip to content

Commit

Permalink
Attempt to fix some web test flakiness. (#149828)
Browse files Browse the repository at this point in the history
If the service is disposed when we make calls on it, we need to bubble up an exception that is understood by the callers.

This is another speculative fix for flutter/flutter#149238.
  • Loading branch information
eyebrowsoffire authored Jun 6, 2024
1 parent 01d1e74 commit 5fb34b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/flutter_tools/lib/src/vmservice.dart
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,9 @@ class FlutterVmService {
}
}
return await extensionAdded.future;
} on vm_service.RPCError {
// Translate this exception into something the outer layer understands
throw VmServiceDisappearedException();
} finally {
await isolateEvents.cancel();
try {
Expand Down
11 changes: 11 additions & 0 deletions packages/flutter_tools/test/general.shard/vmservice_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,17 @@ void main() {
throwsA(isA<VmServiceDisappearedException>()),
);
});

testWithoutContext('throws when the service is disposed', () async {
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);

await fakeVmServiceHost.vmService.dispose();

expect(
() => fakeVmServiceHost.vmService.findExtensionIsolate(kExtensionName),
throwsA(isA<VmServiceDisappearedException>()),
);
});
});

testWithoutContext('Can process log events from the vm service', () {
Expand Down

0 comments on commit 5fb34b7

Please sign in to comment.