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.
This commit is contained in:
parent
8f85c7c5b8
commit
1d904b641b
@ -859,119 +859,6 @@ void main() {
|
|||||||
);
|
);
|
||||||
expect(fakeSkiaClient.initCalls, 0);
|
expect(fakeSkiaClient.initCalls, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
group('correctly determines testing environment', () {
|
|
||||||
test('returns true for configured Luci', () {
|
|
||||||
final FakePlatform platform = FakePlatform(
|
|
||||||
environment: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'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', () {
|
group('Pre-Submit', () {
|
||||||
@ -1057,214 +944,6 @@ void main() {
|
|||||||
);
|
);
|
||||||
expect(fakeSkiaClient.tryInitCalls, 0);
|
expect(fakeSkiaClient.tryInitCalls, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
group('correctly determines testing environment', () {
|
|
||||||
test('returns false on release branches in presubmit', () {
|
|
||||||
final FakePlatform platform = FakePlatform(
|
|
||||||
environment: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'FLUTTER_ROOT': _kFlutterRoot,
|
|
||||||
},
|
|
||||||
operatingSystem: 'macos',
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
FlutterPreSubmitFileComparator.isForEnvironment(platform),
|
|
||||||
isFalse,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('returns false - GOLDCTL missing', () {
|
|
||||||
final FakePlatform platform = FakePlatform(
|
|
||||||
environment: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'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: <String, String>{
|
|
||||||
'FLUTTER_ROOT': _kFlutterRoot,
|
|
||||||
},
|
|
||||||
operatingSystem: 'macos',
|
|
||||||
);
|
|
||||||
expect(
|
|
||||||
FlutterSkippingFileComparator.isForEnvironment(platform),
|
|
||||||
isFalse,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
group('Local', () {
|
group('Local', () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user