Teach test bot about Pigeon tests (#2333)
* Teach test bot about Pigeon tests
The `pigeon` package in flutter/packages has a very unusual test
structure, with several plugins and a common shared library that are all
just tests for generated Pigeon code. This causes a lot of false
positives with the test bot, so this adds the `platform_tests` directory
to the list of known tests.
* Autoformat
diff --git a/app_dart/lib/src/request_handlers/github/webhook_subscription.dart b/app_dart/lib/src/request_handlers/github/webhook_subscription.dart
index fcfa650..b17b323 100644
--- a/app_dart/lib/src/request_handlers/github/webhook_subscription.dart
+++ b/app_dart/lib/src/request_handlers/github/webhook_subscription.dart
@@ -486,7 +486,9 @@
// Native Linux tests.
filename.endsWith('_test.cc') ||
// Native Windows tests.
- filename.endsWith('_test.cpp')) {
+ filename.endsWith('_test.cpp') ||
+ // Pigeon native tests.
+ filename.contains('/platform_tests/')) {
hasTests = true;
}
}
diff --git a/app_dart/test/request_handlers/github/webhook_subscription_test.dart b/app_dart/test/request_handlers/github/webhook_subscription_test.dart
index 7dba6b4..3ce473b 100644
--- a/app_dart/test/request_handlers/github/webhook_subscription_test.dart
+++ b/app_dart/test/request_handlers/github/webhook_subscription_test.dart
@@ -2443,6 +2443,33 @@
);
});
+ test('Packages does not comment if Pigeon native tests', () async {
+ const int issueNumber = 123;
+
+ tester.message = generateGithubWebhookMessage(
+ action: 'opened',
+ number: issueNumber,
+ slug: Config.packagesSlug,
+ );
+ when(pullRequestsService.listFiles(Config.packagesSlug, issueNumber)).thenAnswer(
+ (_) => Stream<PullRequestFile>.fromIterable(<PullRequestFile>[
+ PullRequestFile()..filename = 'packages/pigeon/lib/swift_generator.dart',
+ PullRequestFile()
+ ..filename = 'packages/pigeon/platform_tests/shared_test_plugin_code/lib/integration_tests.dart',
+ ]),
+ );
+
+ await tester.post(webhook);
+
+ verifyNever(
+ issuesService.createComment(
+ Config.pluginsSlug,
+ issueNumber,
+ argThat(contains(config.missingTestsPullRequestMessageValue)),
+ ),
+ );
+ });
+
test('Packages comments and labels if no tests', () async {
const int issueNumber = 123;