Unverified Commit 48fc1350 authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

Revert "Refactoring Gold to enable both Luci & Cirrus support (#49815)" (#52670)

This reverts commit 7edcc92b.
parent acd51a72
...@@ -85,8 +85,7 @@ const double _kDividerThickness = 1.0; ...@@ -85,8 +85,7 @@ const double _kDividerThickness = 1.0;
/// sheet title and message text style. /// sheet title and message text style.
/// ///
/// To display action buttons that look like standard iOS action sheet buttons, /// To display action buttons that look like standard iOS action sheet buttons,
/// provide [CupertinoActionSheetAction]s for the [actions] given to this action /// provide [CupertinoActionSheetAction]s for the [actions] given to this action sheet.
/// sheet.
/// ///
/// To include a iOS-style cancel button separate from the other buttons, /// To include a iOS-style cancel button separate from the other buttons,
/// provide an [CupertinoActionSheetAction] for the [cancelButton] given to this /// provide an [CupertinoActionSheetAction] for the [cancelButton] given to this
......
...@@ -108,7 +108,6 @@ void main() { ...@@ -108,7 +108,6 @@ void main() {
process: process, process: process,
platform: platform, platform: platform,
httpClient: mockHttpClient, httpClient: mockHttpClient,
ci: ContinuousIntegrationEnvironment.cirrus,
); );
when(process.run(any)) when(process.run(any))
...@@ -166,76 +165,6 @@ void main() { ...@@ -166,76 +165,6 @@ void main() {
); );
}); });
test('correctly inits tryjob for luci', () async {
platform = FakePlatform(
environment: <String, String>{
'FLUTTER_ROOT': _kFlutterRoot,
'GOLDCTL' : 'goldctl',
'SWARMING_TASK_ID' : '4ae997b50dfd4d11',
'LOGDOG_STREAM_PREFIX' : 'buildbucket/cr-buildbucket.appspot.com/8885996262141582672',
'GOLD_TRYJOB' : 'refs/pull/49815/head',
},
operatingSystem: 'macos'
);
skiaClient = SkiaGoldClient(
workDirectory,
fs: fs,
process: process,
platform: platform,
httpClient: mockHttpClient,
ci: ContinuousIntegrationEnvironment.luci,
);
final List<String> ciArguments = skiaClient.getCIArguments();
expect(
ciArguments,
equals(
<String>[
'--changelist', '49815',
'--cis', 'buildbucket',
'--jobid', '8885996262141582672',
],
),
);
});
test('correctly inits tryjob for cirrus', () async {
platform = FakePlatform(
environment: <String, String>{
'FLUTTER_ROOT': _kFlutterRoot,
'GOLDCTL' : 'goldctl',
'CIRRUS_CI' : 'true',
'CIRRUS_TASK_ID' : '8885996262141582672',
'CIRRUS_PR' : '49815',
},
operatingSystem: 'macos'
);
skiaClient = SkiaGoldClient(
workDirectory,
fs: fs,
process: process,
platform: platform,
httpClient: mockHttpClient,
ci: ContinuousIntegrationEnvironment.cirrus,
);
final List<String> ciArguments = skiaClient.getCIArguments();
expect(
ciArguments,
equals(
<String>[
'--changelist', '49815',
'--cis', 'cirrus',
'--jobid', '8885996262141582672',
],
),
);
});
group('Request Handling', () { group('Request Handling', () {
String testName; String testName;
String pullRequestNumber; String pullRequestNumber;
...@@ -527,12 +456,12 @@ void main() { ...@@ -527,12 +456,12 @@ void main() {
}); });
group('FlutterGoldenFileComparator', () { group('FlutterGoldenFileComparator', () {
FlutterPostSubmitFileComparator comparator; FlutterSkiaGoldFileComparator comparator;
setUp(() { setUp(() {
final Directory basedir = fs.directory('flutter/test/library/') final Directory basedir = fs.directory('flutter/test/library/')
..createSync(recursive: true); ..createSync(recursive: true);
comparator = FlutterPostSubmitFileComparator( comparator = FlutterSkiaGoldFileComparator(
basedir.uri, basedir.uri,
MockSkiaGoldClient(), MockSkiaGoldClient(),
fs: fs, fs: fs,
...@@ -568,7 +497,7 @@ void main() { ...@@ -568,7 +497,7 @@ void main() {
setUp(() { setUp(() {
final Directory basedir = fs.directory('flutter/test/library/') final Directory basedir = fs.directory('flutter/test/library/')
..createSync(recursive: true); ..createSync(recursive: true);
comparator = FlutterPostSubmitFileComparator( comparator = FlutterSkiaGoldFileComparator(
basedir.uri, basedir.uri,
mockSkiaClient, mockSkiaClient,
fs: fs, fs: fs,
...@@ -577,21 +506,7 @@ void main() { ...@@ -577,21 +506,7 @@ void main() {
}); });
group('correctly determines testing environment', () { group('correctly determines testing environment', () {
test('returns true for Luci', () { test('returns true', () {
platform = FakePlatform(
environment: <String, String>{
'FLUTTER_ROOT': _kFlutterRoot,
'SWARMING_TASK_ID' : '12345678990',
},
operatingSystem: 'macos'
);
expect(
FlutterPostSubmitFileComparator.isAvailableForEnvironment(platform),
isTrue,
);
});
test('returns true for Cirrus', () {
platform = FakePlatform( platform = FakePlatform(
environment: <String, String>{ environment: <String, String>{
'FLUTTER_ROOT': _kFlutterRoot, 'FLUTTER_ROOT': _kFlutterRoot,
...@@ -603,7 +518,7 @@ void main() { ...@@ -603,7 +518,7 @@ void main() {
operatingSystem: 'macos' operatingSystem: 'macos'
); );
expect( expect(
FlutterPostSubmitFileComparator.isAvailableForEnvironment(platform), FlutterSkiaGoldFileComparator.isAvailableForEnvironment(platform),
isTrue, isTrue,
); );
}); });
...@@ -620,7 +535,7 @@ void main() { ...@@ -620,7 +535,7 @@ void main() {
operatingSystem: 'macos' operatingSystem: 'macos'
); );
expect( expect(
FlutterPostSubmitFileComparator.isAvailableForEnvironment(platform), FlutterSkiaGoldFileComparator.isAvailableForEnvironment(platform),
isFalse, isFalse,
); );
}); });
...@@ -636,7 +551,7 @@ void main() { ...@@ -636,7 +551,7 @@ void main() {
operatingSystem: 'macos' operatingSystem: 'macos'
); );
expect( expect(
FlutterPostSubmitFileComparator.isAvailableForEnvironment(platform), FlutterSkiaGoldFileComparator.isAvailableForEnvironment(platform),
isFalse, isFalse,
); );
}); });
...@@ -651,7 +566,7 @@ void main() { ...@@ -651,7 +566,7 @@ void main() {
operatingSystem: 'macos' operatingSystem: 'macos'
); );
expect( expect(
FlutterPostSubmitFileComparator.isAvailableForEnvironment(platform), FlutterSkiaGoldFileComparator.isAvailableForEnvironment(platform),
isFalse, isFalse,
); );
}); });
...@@ -668,7 +583,7 @@ void main() { ...@@ -668,7 +583,7 @@ void main() {
operatingSystem: 'macos' operatingSystem: 'macos'
); );
expect( expect(
FlutterPostSubmitFileComparator.isAvailableForEnvironment(platform), FlutterSkiaGoldFileComparator.isAvailableForEnvironment(platform),
isFalse, isFalse,
); );
}); });
...@@ -680,7 +595,7 @@ void main() { ...@@ -680,7 +595,7 @@ void main() {
final MockSkiaGoldClient mockSkiaClient = MockSkiaGoldClient(); final MockSkiaGoldClient mockSkiaClient = MockSkiaGoldClient();
group('correctly determines testing environment', () { group('correctly determines testing environment', () {
test('returns true for Cirrus', () { test('returns true', () {
platform = FakePlatform( platform = FakePlatform(
environment: <String, String>{ environment: <String, String>{
'FLUTTER_ROOT': _kFlutterRoot, 'FLUTTER_ROOT': _kFlutterRoot,
...@@ -696,21 +611,6 @@ void main() { ...@@ -696,21 +611,6 @@ void main() {
); );
}); });
test('returns true for Luci', () {
platform = FakePlatform(
environment: <String, String>{
'FLUTTER_ROOT': _kFlutterRoot,
'SWARMING_TASK_ID' : '12345678990',
'GOLD_TRYJOB' : 'git/ref/12345/head'
},
operatingSystem: 'macos'
);
expect(
FlutterPreSubmitFileComparator.isAvailableForEnvironment(platform),
isTrue,
);
});
test('returns false - no PR', () { test('returns false - no PR', () {
platform = FakePlatform( platform = FakePlatform(
environment: <String, String>{ environment: <String, String>{
...@@ -742,7 +642,7 @@ void main() { ...@@ -742,7 +642,7 @@ void main() {
); );
}); });
test('returns false - not on Cirrus or Luci', () { test('returns false - not on Cirrus', () {
platform = FakePlatform( platform = FakePlatform(
environment: <String, String>{ environment: <String, String>{
'FLUTTER_ROOT': _kFlutterRoot, 'FLUTTER_ROOT': _kFlutterRoot,
...@@ -865,20 +765,33 @@ void main() { ...@@ -865,20 +765,33 @@ void main() {
group('Skipping', () { group('Skipping', () {
group('correctly determines testing environment', () { group('correctly determines testing environment', () {
test('returns true on Cirrus shards that don\'t run golden tests', () { test('returns true on LUCI', () {
platform = FakePlatform( platform = FakePlatform(
environment: <String, String>{ environment: <String, String>{
'FLUTTER_ROOT': _kFlutterRoot, 'FLUTTER_ROOT': _kFlutterRoot,
'CIRRUS_CI' : 'yep', 'SWARMING_TASK_ID' : '1234567890',
}, },
operatingSystem: 'macos' operatingSystem: 'macos'
); );
expect( expect(
FlutterSkippingFileComparator.isAvailableForEnvironment(platform), FlutterSkippingGoldenFileComparator.isAvailableForEnvironment(platform),
isTrue, isTrue,
); );
}); });
test('returns true on Cirrus', () {
platform = FakePlatform(
environment: <String, String>{
'FLUTTER_ROOT': _kFlutterRoot,
'CIRRUS_CI' : 'yep',
},
operatingSystem: 'macos'
);
expect(
FlutterSkippingGoldenFileComparator.isAvailableForEnvironment(platform),
isTrue,
);
});
test('returns false - no CI', () { test('returns false - no CI', () {
platform = FakePlatform( platform = FakePlatform(
environment: <String, String>{ environment: <String, String>{
...@@ -887,7 +800,7 @@ void main() { ...@@ -887,7 +800,7 @@ void main() {
operatingSystem: 'macos' operatingSystem: 'macos'
); );
expect( expect(
FlutterSkippingFileComparator.isAvailableForEnvironment( FlutterSkippingGoldenFileComparator.isAvailableForEnvironment(
platform), platform),
isFalse, isFalse,
); );
...@@ -978,7 +891,7 @@ void main() { ...@@ -978,7 +891,7 @@ void main() {
goldens: mockSkiaClient, goldens: mockSkiaClient,
baseDirectory: mockDirectory, baseDirectory: mockDirectory,
); );
expect(comparator.runtimeType, FlutterSkippingFileComparator); expect(comparator.runtimeType, FlutterSkippingGoldenFileComparator);
when(mockSkiaClient.getExpectations()) when(mockSkiaClient.getExpectations())
.thenAnswer((_) => throw const SocketException("Can't reach Gold")); .thenAnswer((_) => throw const SocketException("Can't reach Gold"));
...@@ -987,7 +900,7 @@ void main() { ...@@ -987,7 +900,7 @@ void main() {
goldens: mockSkiaClient, goldens: mockSkiaClient,
baseDirectory: mockDirectory, baseDirectory: mockDirectory,
); );
expect(comparator.runtimeType, FlutterSkippingFileComparator); expect(comparator.runtimeType, FlutterSkippingGoldenFileComparator);
}); });
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment