Anaalyzer fixes.

This commit is contained in:
Kate Lovett 2019-04-25 15:59:48 -07:00
parent abb555fe94
commit fdd554fb46
3 changed files with 17 additions and 17 deletions

View file

@ -91,7 +91,7 @@ class FlutterGoldenFileComparator implements GoldenFileComparator {
} }
final bool authorized = await _skiaClient.auth(fs.directory(basedir)); final bool authorized = await _skiaClient.auth(fs.directory(basedir));
if (!authorized) { if (!authorized) {
//TODO(katelovett): Clean up for final implementation on CI // TODO(Piinks): Clean up for final implementation on CI, https://github.com/flutter/flutter/pull/31630
return true; return true;
//throw test_package.TestFailure('Could not authorize golctl.'); //throw test_package.TestFailure('Could not authorize golctl.');
} }

View file

@ -13,35 +13,36 @@ import 'package:platform/platform.dart';
import 'package:process/process.dart'; import 'package:process/process.dart';
const String _kFlutterRoot = '/flutter'; const String _kFlutterRoot = '/flutter';
const String _kGoldenRoot = '$_kFlutterRoot/bin/cache/pkg/goldens'; //const String _kGoldenRoot = '$_kFlutterRoot/bin/cache/pkg/goldens';
//const String _kVersionFile = '$_kFlutterRoot/bin/internal/goldens.version'; //const String _kVersionFile = '$_kFlutterRoot/bin/internal/goldens.version';
//const String _kGoldensVersion = '123456abcdef'; //const String _kGoldensVersion = '123456abcdef';
//TODO(katelovett): Finish testing // TODO(Piinks): Finish testing, https://github.com/flutter/flutter/pull/31630
void main() { void main() {
MemoryFileSystem fs; MemoryFileSystem fs;
FakePlatform platform; FakePlatform platform;
MockProcessManager process; MockProcessManager process;
Directory flutter; //Directory flutter;
Directory golden; //Directory golden;
setUp(() async { setUp(() async {
fs = MemoryFileSystem(); fs = MemoryFileSystem();
platform = FakePlatform(environment: <String, String>{ platform = FakePlatform(environment: <String, String>{
'FLUTTER_ROOT': _kFlutterRoot, 'FLUTTER_ROOT': _kFlutterRoot,
//TODO(katelovett): Add other env vars for testing // TODO(Piinks): Add other env vars for testing, https://github.com/flutter/flutter/pull/31630
}); });
process = MockProcessManager(); process = MockProcessManager();
flutter = await fs.directory(_kFlutterRoot).create(recursive: true); //flutter = await fs.directory(_kFlutterRoot).create(recursive: true);
golden = await fs.directory(_kGoldenRoot).create(recursive: true); //golden = await fs.directory(_kGoldenRoot).create(recursive: true);
//fs.file(_kVersionFile).createSync(recursive: true); //fs.file(_kVersionFile).createSync(recursive: true);
//fs.file(_kVersionFile).writeAsStringSync(_kGoldensVersion); //fs.file(_kVersionFile).writeAsStringSync(_kGoldensVersion);
}); });
group('SkiaGoldClient', () { group('SkiaGoldClient', () {
SkiaGoldClient skiaGold; //SkiaGoldClient skiaGold;
setUp(() { setUp(() {
skiaGold = SkiaGoldClient( //skiaGold =
SkiaGoldClient(
fs: fs, fs: fs,
platform: platform, platform: platform,
process: process, process: process,
@ -105,7 +106,7 @@ void main() {
} }
}); });
// TODO(katelovett): This is currently disabled in flutter_goldens.dart // TODO(Piinks): This is currently disabled in flutter_goldens.dart, https://github.com/flutter/flutter/pull/31630
// test('throws if goldctl has not been authorized', () async { // test('throws if goldctl has not been authorized', () async {
// // See that preceding test does not leave auth behind [52] // // See that preceding test does not leave auth behind [52]
// try { // try {
@ -115,8 +116,7 @@ void main() {
// expect(error.message, contains('Could not authorize goldctl.')); // expect(error.message, contains('Could not authorize goldctl.'));
// } // }
// }); // });
// TODO(katelovett): Add methods to Mock SkiaGoldClient to inform the comparator // TODO(Piinks): Add methods to Mock SkiaGoldClient to inform the comparator and test for proper behavior. See matcher_test.dart for model, https://github.com/flutter/flutter/pull/31630
// TODO... and test for proper behavior. See matcher_test.dart for model
// test('returns false if skia gold test fails', () async { // test('returns false if skia gold test fails', () async {
// final File goldenFile = fs.file('/path/to/flutter/bin/cache/goldens/test/foo/bar/test.png') // final File goldenFile = fs.file('/path/to/flutter/bin/cache/goldens/test/foo/bar/test.png')
// ..createSync(recursive: true); // ..createSync(recursive: true);

View file

@ -51,7 +51,7 @@ class SkiaGoldClient {
Directory _workDirectory; Directory _workDirectory;
//TODO(katelovett): Environment variables are temporary for local testing // TODO(Piinks): Environment variables are temporary for local testing, https://github.com/flutter/flutter/pull/31630
/// The local [Directory] where the Flutter repository is hosted. /// The local [Directory] where the Flutter repository is hosted.
/// ///
/// Uses the [fs] file system. /// Uses the [fs] file system.
@ -80,7 +80,7 @@ class SkiaGoldClient {
Future<bool> auth(Directory workDirectory) async { Future<bool> auth(Directory workDirectory) async {
_workDirectory = workDirectory; _workDirectory = workDirectory;
//TODO(katelovett): Cleanup for final CI implementation // TODO(Piinks): Cleanup for final CI implementation, https://github.com/flutter/flutter/pull/31630
if (_serviceAccount == null) if (_serviceAccount == null)
return false; // Not in the proper environment for golden file testing. return false; // Not in the proper environment for golden file testing.
@ -188,7 +188,7 @@ class SkiaGoldClient {
} }
Future<String> _getCommitHash() async { Future<String> _getCommitHash() async {
// TODO(katelovett): Remove after pre-commit tests can be ingested by Skia Gold // TODO(Piinks): Remove after pre-commit tests can be ingested by Skia Gold, https://github.com/flutter/flutter/pull/31630
return 'e51947241b37790a9e4e33bfdef59aaa9b930851'; return 'e51947241b37790a9e4e33bfdef59aaa9b930851';
// if (!flutterRoot.existsSync()) { // if (!flutterRoot.existsSync()) {
// return null; // return null;
@ -214,7 +214,7 @@ class SkiaGoldClient {
} }
String _getKeysJSON() { String _getKeysJSON() {
// TODO(katelovett): Parse out cleaner key information // TODO(Piinks): Parse out cleaner key information, https://github.com/flutter/flutter/pull/31630
return convert.json.encode( return convert.json.encode(
<String, dynamic>{ <String, dynamic>{
'Operating System' : io.Platform.operatingSystem, 'Operating System' : io.Platform.operatingSystem,