From 1d904b641bb70ea18303c124aa36d5b64eec80b5 Mon Sep 17 00:00:00 2001 From: Ian Hickson Date: Wed, 17 Apr 2024 12:23:26 -0700 Subject: [PATCH] Remove now-redundant tests for isForEnvironment (#146804) This is part 11 of a broken down version of the #140101 refactor. These tests are redundant with the more comprehensive tests now in comparator_selection_test.dart. --- .../test/flutter_goldens_test.dart | 321 ------------------ 1 file changed, 321 deletions(-) diff --git a/packages/flutter_goldens/test/flutter_goldens_test.dart b/packages/flutter_goldens/test/flutter_goldens_test.dart index 3ffcf703c2..2f63b29fdc 100644 --- a/packages/flutter_goldens/test/flutter_goldens_test.dart +++ b/packages/flutter_goldens/test/flutter_goldens_test.dart @@ -859,119 +859,6 @@ void main() { ); expect(fakeSkiaClient.initCalls, 0); }); - - group('correctly determines testing environment', () { - test('returns true for configured Luci', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'SWARMING_TASK_ID' : '12345678990', - 'GOLDCTL' : 'goldctl', - 'GIT_BRANCH' : 'master', - }, - operatingSystem: 'macos', - ); - expect( - FlutterPostSubmitFileComparator.isForEnvironment(platform), - isTrue, - ); - }); - - test('returns false on release branches in postsubmit', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'SWARMING_TASK_ID' : 'sweet task ID', - 'GOLDCTL' : 'some/path', - 'GIT_BRANCH' : 'flutter-3.16-candidate.0', - }, - operatingSystem: 'macos', - ); - expect( - FlutterPostSubmitFileComparator.isForEnvironment(platform), - isFalse, - ); - }); - - test('returns true on master branch in postsubmit', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'SWARMING_TASK_ID' : 'sweet task ID', - 'GOLDCTL' : 'some/path', - 'GIT_BRANCH' : 'master', - }, - operatingSystem: 'macos', - ); - expect( - FlutterPostSubmitFileComparator.isForEnvironment(platform), - isTrue, - ); - }); - - test('returns true on main branch in postsubmit', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'SWARMING_TASK_ID' : 'sweet task ID', - 'GOLDCTL' : 'some/path', - 'GIT_BRANCH' : 'main', - }, - operatingSystem: 'macos', - ); - expect( - FlutterPostSubmitFileComparator.isForEnvironment(platform), - isTrue, - ); - }); - - test('returns false - GOLDCTL not present', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'SWARMING_TASK_ID' : '12345678990', - }, - operatingSystem: 'macos', - ); - expect( - FlutterPostSubmitFileComparator.isForEnvironment(platform), - isFalse, - ); - }); - - test('returns false - GOLD_TRYJOB active', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'SWARMING_TASK_ID' : '12345678990', - 'GOLDCTL' : 'goldctl', - 'GOLD_TRYJOB' : 'git/ref/12345/head', - }, - operatingSystem: 'macos', - ); - expect( - FlutterPostSubmitFileComparator.isForEnvironment(platform), - isFalse, - ); - }); - - test('returns false - on Cirrus', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'CIRRUS_CI': 'true', - 'CIRRUS_PR': '', - 'CIRRUS_BRANCH': 'master', - 'GOLD_SERVICE_ACCOUNT': 'service account...', - }, - operatingSystem: 'macos', - ); - expect( - FlutterPostSubmitFileComparator.isForEnvironment(platform), - isFalse, - ); - }); - }); }); group('Pre-Submit', () { @@ -1057,214 +944,6 @@ void main() { ); expect(fakeSkiaClient.tryInitCalls, 0); }); - - group('correctly determines testing environment', () { - test('returns false on release branches in presubmit', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'SWARMING_TASK_ID' : 'sweet task ID', - 'GOLDCTL' : 'some/path', - 'GOLD_TRYJOB' : 'true', - 'GIT_BRANCH' : 'flutter-3.16-candidate.0', - }, - operatingSystem: 'macos', - ); - expect( - FlutterPreSubmitFileComparator.isForEnvironment(platform), - isFalse, - ); - }); - - test('returns true on master branch in presubmit', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'SWARMING_TASK_ID' : 'sweet task ID', - 'GOLDCTL' : 'some/path', - 'GOLD_TRYJOB' : 'true', - 'GIT_BRANCH' : 'master', - }, - operatingSystem: 'macos', - ); - expect( - FlutterPreSubmitFileComparator.isForEnvironment(platform), - isTrue, - ); - }); - - test('returns true on main branch in presubmit', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'SWARMING_TASK_ID' : 'sweet task ID', - 'GOLDCTL' : 'some/path', - 'GOLD_TRYJOB' : 'true', - 'GIT_BRANCH' : 'main', - }, - operatingSystem: 'macos', - ); - expect( - FlutterPreSubmitFileComparator.isForEnvironment(platform), - isTrue, - ); - }); - - test('returns true for Luci', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'SWARMING_TASK_ID' : '12345678990', - 'GOLDCTL' : 'goldctl', - 'GOLD_TRYJOB' : 'git/ref/12345/head', - 'GIT_BRANCH' : 'master', - }, - operatingSystem: 'macos', - ); - expect( - FlutterPreSubmitFileComparator.isForEnvironment(platform), - isTrue, - ); - }); - - test('returns false - not on Luci', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - }, - operatingSystem: 'macos', - ); - expect( - FlutterPreSubmitFileComparator.isForEnvironment(platform), - isFalse, - ); - }); - - test('returns false - GOLDCTL missing', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'SWARMING_TASK_ID' : '12345678990', - 'GOLD_TRYJOB' : 'git/ref/12345/head', - }, - operatingSystem: 'macos', - ); - expect( - FlutterPreSubmitFileComparator.isForEnvironment(platform), - isFalse, - ); - }); - - test('returns false - GOLD_TRYJOB missing', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'SWARMING_TASK_ID' : '12345678990', - 'GOLDCTL' : 'goldctl', - }, - operatingSystem: 'macos', - ); - expect( - FlutterPreSubmitFileComparator.isForEnvironment(platform), - isFalse, - ); - }); - - test('returns false - on Cirrus', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'CIRRUS_CI': 'true', - 'CIRRUS_PR': '', - 'CIRRUS_BRANCH': 'master', - 'GOLD_SERVICE_ACCOUNT': 'service account...', - }, - operatingSystem: 'macos', - ); - expect( - FlutterPostSubmitFileComparator.isForEnvironment(platform), - isFalse, - ); - }); - }); - }); - - group('Skipping', () { - group('correctly determines testing environment', () { - test('returns true on release branches in presubmit', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'SWARMING_TASK_ID' : 'sweet task ID', - 'GOLDCTL' : 'some/path', - 'GOLD_TRYJOB' : 'true', - 'GIT_BRANCH' : 'flutter-3.16-candidate.0', - }, - operatingSystem: 'macos', - ); - expect( - FlutterSkippingFileComparator.isForEnvironment(platform), - isTrue, - ); - }); - - test('returns true on release branches in postsubmit', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'SWARMING_TASK_ID' : 'sweet task ID', - 'GOLDCTL' : 'some/path', - 'GIT_BRANCH' : 'flutter-3.16-candidate.0', - }, - operatingSystem: 'macos', - ); - expect( - FlutterSkippingFileComparator.isForEnvironment(platform), - isTrue, - ); - }); - - test('returns true on Cirrus builds', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'CIRRUS_CI' : 'yep', - }, - operatingSystem: 'macos', - ); - expect( - FlutterSkippingFileComparator.isForEnvironment(platform), - isTrue, - ); - }); - - test('returns true on irrelevant LUCI builds', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - 'SWARMING_TASK_ID' : '1234567890', - }, - operatingSystem: 'macos' - ); - expect( - FlutterSkippingFileComparator.isForEnvironment(platform), - isTrue, - ); - }); - - test('returns false - not in CI', () { - final FakePlatform platform = FakePlatform( - environment: { - 'FLUTTER_ROOT': _kFlutterRoot, - }, - operatingSystem: 'macos', - ); - expect( - FlutterSkippingFileComparator.isForEnvironment(platform), - isFalse, - ); - }); - }); }); group('Local', () {