From 8a8616f913f122a606f3a129639fe403f8b61208 Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Tue, 20 Feb 2024 17:57:23 +0000 Subject: [PATCH] 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. --- packages/flutter_goldens/lib/flutter_goldens.dart | 7 +++++++ .../flutter_goldens/test/flutter_goldens_test.dart | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/packages/flutter_goldens/lib/flutter_goldens.dart b/packages/flutter_goldens/lib/flutter_goldens.dart index b6d3eb79374f..a0524dfbb67e 100644 --- a/packages/flutter_goldens/lib/flutter_goldens.dart +++ b/packages/flutter_goldens/lib/flutter_goldens.dart @@ -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); diff --git a/packages/flutter_goldens/test/flutter_goldens_test.dart b/packages/flutter_goldens/test/flutter_goldens_test.dart index 3e2c05ea9cfc..601d45403132 100644 --- a/packages/flutter_goldens/test/flutter_goldens_test.dart +++ b/packages/flutter_goldens/test/flutter_goldens_test.dart @@ -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; });