Ensure that integration tests are actually being run (#3857)

Many of our integration tests weren't actually being run on CI because they were in the wrong place and/or missing the driver file, and it seems we've just never noticed. This makes a number of changes:
- Ensures that all packages with integration tests also have a driver file in the right location.
  - Also standardizes the format of those files, as the boilerplate `main()` is available in `integration_test`.
- Ensures that all integration_test directories are in the right place.
  - In a couple of places, removes a duplicate copy of the integration test file.
- Makes it an error for a plugin that's not excluded to not have integration tests, so this can't easily happen again.
- Adds logging of what's being run and skipped, so if something does go wrong in the future it's easy to determine what from the logs.
  - Excludes `*_platform_interface` since the logging was (potentially confusingly) reporting that they were skipped because they don't support the current platform. Skipping them is correct, just not for that reason.
- Excludes the plugins that currently have no integration tests, with references to issues about adding them.

Fixes https://github.com/flutter/flutter/issues/81929
This commit is contained in:
stuartmorgan
2021-05-10 14:14:45 -04:00
committed by GitHub
parent 41df811fbd
commit ce899a3151
2 changed files with 90 additions and 4 deletions

View File

@ -55,6 +55,7 @@ void main() {
expect(
output,
orderedEquals(<String>[
'\n==========\nChecking plugin...',
'\n\n',
'All driver tests successful!',
]),
@ -100,6 +101,7 @@ void main() {
expect(
output,
orderedEquals(<String>[
'\n==========\nChecking plugin...',
'\n\n',
'All driver tests successful!',
]),
@ -143,6 +145,25 @@ void main() {
throwsA(const TypeMatcher<ToolExit>()));
});
test('a plugin without any integration test files is reported as an error',
() async {
createFakePlugin('plugin',
withExtraFiles: <List<String>>[
<String>['example', 'lib', 'main.dart'],
],
isAndroidPlugin: true,
isIosPlugin: true);
final Directory pluginExampleDirectory =
mockPackagesDir.childDirectory('plugin').childDirectory('example');
createFakePubspec(pluginExampleDirectory, isFlutter: true);
await expectLater(
() => runCapturingPrint(runner, <String>['drive-examples']),
throwsA(const TypeMatcher<ToolExit>()));
});
test(
'driving under folder "test_driver" when targets are under "integration_test"',
() async {
@ -168,6 +189,7 @@ void main() {
expect(
output,
orderedEquals(<String>[
'\n==========\nChecking plugin...',
'\n\n',
'All driver tests successful!',
]),
@ -223,6 +245,8 @@ void main() {
expect(
output,
orderedEquals(<String>[
'\n==========\nChecking plugin...',
'Not supported for the target platform; skipping.',
'\n\n',
'All driver tests successful!',
]),
@ -255,6 +279,7 @@ void main() {
expect(
output,
orderedEquals(<String>[
'\n==========\nChecking plugin...',
'\n\n',
'All driver tests successful!',
]),
@ -300,6 +325,8 @@ void main() {
expect(
output,
orderedEquals(<String>[
'\n==========\nChecking plugin...',
'Not supported for the target platform; skipping.',
'\n\n',
'All driver tests successful!',
]),
@ -332,6 +359,7 @@ void main() {
expect(
output,
orderedEquals(<String>[
'\n==========\nChecking plugin...',
'\n\n',
'All driver tests successful!',
]),
@ -379,6 +407,8 @@ void main() {
expect(
output,
orderedEquals(<String>[
'\n==========\nChecking plugin...',
'Not supported for the target platform; skipping.',
'\n\n',
'All driver tests successful!',
]),
@ -411,6 +441,7 @@ void main() {
expect(
output,
orderedEquals(<String>[
'\n==========\nChecking plugin...',
'\n\n',
'All driver tests successful!',
]),
@ -460,6 +491,8 @@ void main() {
expect(
output,
orderedEquals(<String>[
'\n==========\nChecking plugin...',
'Not supported for the target platform; skipping.',
'\n\n',
'All driver tests successful!',
]),
@ -492,6 +525,7 @@ void main() {
expect(
output,
orderedEquals(<String>[
'\n==========\nChecking plugin...',
'\n\n',
'All driver tests successful!',
]),
@ -535,6 +569,29 @@ void main() {
'drive-examples',
]);
expect(
output,
orderedEquals(<String>[
'\n==========\nChecking plugin...',
'Not supported for the target platform; skipping.',
'\n\n',
'All driver tests successful!',
]),
);
print(processRunner.recordedCalls);
// Output should be empty since running drive-examples --macos with no macos
// implementation is a no-op.
expect(processRunner.recordedCalls, <ProcessCall>[]);
});
test('platform interface plugins are silently skipped', () async {
createFakePlugin('aplugin_platform_interface');
final List<String> output = await runCapturingPrint(runner, <String>[
'drive-examples',
]);
expect(
output,
orderedEquals(<String>[