Handle FormatException from SkiaGoldClient (#143755)

Seen in
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20Framework%20Smoke%20Tests/17183/overview
closing the engine tree.
This commit is contained in:
Zachary Anderson 2024-02-20 17:57:23 +00:00 committed by GitHub
parent 6200026a6d
commit 8a8616f913
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View file

@ -507,6 +507,13 @@ class FlutterLocalFileComparator extends FlutterGoldenFileComparator with LocalC
'SocketException occurred, could not reach Gold. '
'Switching to FlutterSkippingGoldenFileComparator.',
);
} on FormatException catch (_) {
return FlutterSkippingFileComparator(
baseDirectory.uri,
goldens,
'FormatException occurred, could not reach Gold. '
'Switching to FlutterSkippingGoldenFileComparator.',
);
}
return FlutterLocalFileComparator(baseDirectory.uri, goldens);

View file

@ -1160,6 +1160,16 @@ void main() {
baseDirectory: fakeDirectory,
);
expect(comparator.runtimeType, FlutterSkippingFileComparator);
fakeSkiaClient.getExpectationForTestThrowable = const FormatException("Can't reach Gold");
comparator = await FlutterLocalFileComparator.fromDefaultComparator(
platform,
goldens: fakeSkiaClient,
baseDirectory: fakeDirectory,
);
expect(comparator.runtimeType, FlutterSkippingFileComparator);
// reset property or it will carry on to other tests
fakeSkiaClient.getExpectationForTestThrowable = null;
});