From bbe870a203f0762ba8a050ed9fe77c2d4d1093d1 Mon Sep 17 00:00:00 2001 From: Casey Hillers Date: Tue, 23 Aug 2022 15:07:15 +0200 Subject: [PATCH] [app_dart] Migrate to super parameters --- app_dart/bin/server.dart | 98 +++++++++++-------- .../lib/src/model/appengine/key_helper.dart | 2 +- .../check_flaky_builders.dart | 7 +- .../file_flaky_issue_and_pr.dart | 7 +- .../lib/src/request_handlers/flush_cache.dart | 9 +- .../get_authentication_status.dart | 9 +- .../src/request_handlers/get_branches.dart | 6 +- .../request_handlers/get_build_status.dart | 9 +- .../request_handlers/get_green_commits.dart | 7 +- .../get_release_branches.dart | 2 +- .../lib/src/request_handlers/get_repos.dart | 6 +- .../lib/src/request_handlers/get_status.dart | 7 +- .../github_rate_limit_status.dart | 5 +- .../src/request_handlers/github_webhook.dart | 6 +- .../postsubmit_luci_subscription.dart | 16 +-- .../presubmit_luci_subscription.dart | 21 ++-- .../push_build_status_to_github.dart | 9 +- .../push_gold_status_to_github.dart | 10 +- .../query_github_graphql.dart | 17 +--- .../src/request_handlers/readiness_check.dart | 3 +- .../src/request_handlers/reset_prod_task.dart | 14 ++- .../src/request_handlers/reset_try_task.dart | 10 +- .../scheduler/batch_backfiller.dart | 5 +- .../scheduler/request_subscription.dart | 13 +-- .../src/request_handlers/update_branches.dart | 6 +- .../update_existing_flaky_issues.dart | 7 +- .../request_handlers/update_task_status.dart | 10 +- .../vacuum_github_commits.dart | 9 +- .../request_handling/api_request_handler.dart | 5 +- .../src/request_handling/authentication.dart | 4 +- .../cache_request_handler.dart | 5 +- .../no_auth_request_handler.dart | 5 +- .../pubsub_authentication.dart | 15 +-- .../request_handling/static_file_handler.dart | 7 +- .../subscription_handler.dart | 9 +- .../swarming_authentication.dart | 15 +-- .../lib/src/service/luci_build_service.dart | 6 +- app_dart/pubspec.lock | 2 +- app_dart/pubspec.yaml | 2 +- .../check_flaky_builders_test.dart | 4 +- .../file_flaky_issue_and_pr_test.dart | 4 +- .../request_handlers/flush_cache_test.dart | 4 +- .../request_handlers/get_branches_test.dart | 2 +- .../get_green_commits_test.dart | 12 +-- .../request_handlers/get_status_test.dart | 8 +- .../request_handlers/github_webhook_test.dart | 2 +- .../postsubmit_luci_subscription_test.dart | 2 +- .../presubmit_luci_subscription_test.dart | 10 +- .../push_build_status_to_github_test.dart | 4 +- .../push_gold_status_to_github_test.dart | 36 +++---- .../query_github_graphql_test.dart | 8 +- .../reset_prod_task_test.dart | 8 +- .../request_handlers/reset_try_task_test.dart | 6 +- .../scheduler/batch_backfiller_test.dart | 2 +- .../update_branches_test.dart | 2 +- .../update_existing_flaky_issues_test.dart | 4 +- .../update_task_status_test.dart | 4 +- .../vacuum_github_commits_test.dart | 4 +- .../request_handling/authentication_test.dart | 6 +- .../pubsub_authentication_test.dart | 10 +- .../swarming_authentication_test.dart | 12 +-- .../test/service/luci_build_service_test.dart | 36 +++---- app_dart/test/service/scheduler_test.dart | 8 +- .../api_request_handler_tester.dart | 6 +- .../fake_request_handler.dart | 5 +- .../no_auth_request_handler_tester.dart | 7 +- .../request_handling/subscription_tester.dart | 6 +- .../src/service/fake_luci_build_service.dart | 8 +- app_dart/test/src/service/fake_scheduler.dart | 15 ++- 69 files changed, 306 insertions(+), 344 deletions(-) diff --git a/app_dart/bin/server.dart b/app_dart/bin/server.dart index 9aa34345f..6a741ee7b 100644 --- a/app_dart/bin/server.dart +++ b/app_dart/bin/server.dart @@ -20,16 +20,16 @@ Future main() async { final CacheService cache = CacheService(inMemory: inMemoryCache); final Config config = Config(dbService, cache); - final AuthenticationProvider authProvider = AuthenticationProvider(config); - final AuthenticationProvider swarmingAuthProvider = SwarmingAuthenticationProvider(config); + final AuthenticationProvider authProvider = AuthenticationProvider(config: config); + final AuthenticationProvider swarmingAuthProvider = SwarmingAuthenticationProvider(config: config); final BuildBucketClient buildBucketClient = BuildBucketClient( accessTokenService: AccessTokenService.defaultProvider(config), ); /// LUCI service class to communicate with buildBucket service. final LuciBuildService luciBuildService = LuciBuildService( - config, - buildBucketClient, + config: config, + buildBucketClient: buildBucketClient, pubsub: const PubSub(), ); @@ -52,16 +52,25 @@ Future main() async { ); final Map> handlers = >{ - '/api/check_flaky_builders': CheckFlakyBuilders(config, authProvider), - '/api/file_flaky_issue_and_pr': FileFlakyIssueAndPR(config, authProvider), + '/api/check_flaky_builders': CheckFlakyBuilders( + config: config, + authenticationProvider: authProvider, + ), + '/api/file_flaky_issue_and_pr': FileFlakyIssueAndPR( + config: config, + authenticationProvider: authProvider, + ), '/api/flush-cache': FlushCache( - config, - authProvider, + config: config, + authenticationProvider: authProvider, cache: cache, ), - '/api/get-authentication-status': GetAuthenticationStatus(config, authProvider), + '/api/get-authentication-status': GetAuthenticationStatus( + config: config, + authenticationProvider: authProvider, + ), '/api/github-webhook-pullrequest': GithubWebhook( - config, + config: config, branchService: branchService, githubChecksService: githubChecksService, scheduler: scheduler, @@ -69,13 +78,16 @@ Future main() async { /// API to run authenticated graphql queries. It requires to pass the graphql query as the body /// of a POST request. - '/api/query-github-graphql': QueryGithubGraphql(config, authProvider), + '/api/query-github-graphql': QueryGithubGraphql( + config: config, + authenticationProvider: authProvider, + ), '/api/presubmit-luci-subscription': PresubmitLuciSubscription( - cache, - config, - buildBucketClient, - luciBuildService, - githubChecksService, + cache: cache, + config: config, + buildBucketClient: buildBucketClient, + luciBuildService: luciBuildService, + githubChecksService: githubChecksService, ), '/api/postsubmit-luci-subscription': PostsubmitLuciSubscription( cache: cache, @@ -84,20 +96,23 @@ Future main() async { scheduler: scheduler, ), '/api/push-build-status-to-github': PushBuildStatusToGithub( - config, - authProvider, + config: config, + authenticationProvider: authProvider, + ), + '/api/push-gold-status-to-github': PushGoldStatusToGithub( + config: config, + authenticationProvider: authProvider, ), - '/api/push-gold-status-to-github': PushGoldStatusToGithub(config, authProvider), '/api/reset-prod-task': ResetProdTask( - config, - authProvider, - luciBuildService, - scheduler, + config: config, + authenticationProvider: authProvider, + luciBuildService: luciBuildService, + scheduler: scheduler, ), '/api/reset-try-task': ResetTryTask( - config, - authProvider, - scheduler, + config: config, + authenticationProvider: authProvider, + scheduler: scheduler, ), '/api/scheduler/batch-backfiller': BatchBackfiller( config: config, @@ -109,10 +124,12 @@ Future main() async { buildBucketClient: buildBucketClient, ), '/api/update_existing_flaky_issues': UpdateExistingFlakyIssue( - config, - authProvider, + config: config, + authenticationProvider: authProvider, + ), + '/api/update-branches': UpdateBranches( + config: config, ), - '/api/update-branches': UpdateBranches(config), /// Updates task related details. /// @@ -130,10 +147,13 @@ Future main() async { /// BenchmarkScoreKeys: (string in body) optional. Benchmark data. /// /// Response: Status 200 OK - '/api/update-task-status': UpdateTaskStatus(config, swarmingAuthProvider), + '/api/update-task-status': UpdateTaskStatus( + config: config, + authenticationProvider: swarmingAuthProvider, + ), '/api/vacuum-github-commits': VacuumGithubCommits( - config, - authProvider, + config: config, + authenticationProvider: authProvider, scheduler: scheduler, ), @@ -156,11 +176,11 @@ Future main() async { '/api/public/build-status': CacheRequestHandler( cache: cache, config: config, - delegate: GetBuildStatus(config), + delegate: GetBuildStatus(config: config), ttl: const Duration(seconds: 15), ), - '/api/public/get-release-branches': GetReleaseBranches(config, branchService: branchService), + '/api/public/get-release-branches': GetReleaseBranches(config: config, branchService: branchService), /// Returns task results for commits. /// @@ -210,15 +230,15 @@ Future main() async { '/api/public/get-status': CacheRequestHandler( cache: cache, config: config, - delegate: GetStatus(config), + delegate: GetStatus(config: config), ), - '/api/public/get-green-commits': GetGreenCommits(config), + '/api/public/get-green-commits': GetGreenCommits(config: config), '/api/public/get-branches': CacheRequestHandler( cache: cache, config: config, - delegate: GetBranches(config), + delegate: GetBranches(config: config), ttl: const Duration(minutes: 15), ), @@ -236,9 +256,9 @@ Future main() async { config: config, cache: cache, ttl: const Duration(minutes: 1), - delegate: GithubRateLimitStatus(config), + delegate: GithubRateLimitStatus(config: config), ), - '/api/public/repos': GetRepos(config), + '/api/public/repos': GetRepos(config: config), /// Handler for AppEngine to identify when dart server is ready to serve requests. '/readiness_check': ReadinessCheck(config: config), diff --git a/app_dart/lib/src/model/appengine/key_helper.dart b/app_dart/lib/src/model/appengine/key_helper.dart index be7098055..001e443d8 100644 --- a/app_dart/lib/src/model/appengine/key_helper.dart +++ b/app_dart/lib/src/model/appengine/key_helper.dart @@ -49,7 +49,7 @@ class KeyHelper { /// type names. /// /// This is initialized when the [KeyHelper] is created by iterating over - /// the `types` argument to the [new KeyHelper] constructor and looking for + /// the `types` argument to the [KeyHelper.new] constructor and looking for /// `@`[Kind] annotations on those classes. final Map types; diff --git a/app_dart/lib/src/request_handlers/check_flaky_builders.dart b/app_dart/lib/src/request_handlers/check_flaky_builders.dart index 88497d2ca..08aa9addc 100644 --- a/app_dart/lib/src/request_handlers/check_flaky_builders.dart +++ b/app_dart/lib/src/request_handlers/check_flaky_builders.dart @@ -13,7 +13,6 @@ import 'package:yaml/yaml.dart'; import '../../protos.dart' as pb; import '../foundation/utils.dart'; import '../request_handling/api_request_handler.dart'; -import '../request_handling/authentication.dart'; import '../request_handling/body.dart'; import '../service/bigquery.dart'; import '../service/config.dart'; @@ -35,8 +34,10 @@ import 'flaky_handler_utils.dart'; /// make the builder unflaky. @immutable class CheckFlakyBuilders extends ApiRequestHandler { - const CheckFlakyBuilders(Config config, AuthenticationProvider authenticationProvider) - : super(config: config, authenticationProvider: authenticationProvider); + const CheckFlakyBuilders({ + required super.config, + required super.authenticationProvider, + }); static int kRecordNumber = 50; diff --git a/app_dart/lib/src/request_handlers/file_flaky_issue_and_pr.dart b/app_dart/lib/src/request_handlers/file_flaky_issue_and_pr.dart index c8e3442a3..f8f926b2f 100644 --- a/app_dart/lib/src/request_handlers/file_flaky_issue_and_pr.dart +++ b/app_dart/lib/src/request_handlers/file_flaky_issue_and_pr.dart @@ -13,7 +13,6 @@ import 'package:yaml/yaml.dart'; import '../../protos.dart' as pb; import '../foundation/utils.dart'; import '../request_handling/api_request_handler.dart'; -import '../request_handling/authentication.dart'; import '../request_handling/body.dart'; import '../service/bigquery.dart'; import '../service/config.dart'; @@ -27,8 +26,10 @@ import 'flaky_handler_utils.dart'; /// the standard when compares the flaky ratios. @immutable class FileFlakyIssueAndPR extends ApiRequestHandler { - const FileFlakyIssueAndPR(Config config, AuthenticationProvider authenticationProvider) - : super(config: config, authenticationProvider: authenticationProvider); + const FileFlakyIssueAndPR({ + required super.config, + required super.authenticationProvider, + }); static const String kThresholdKey = 'threshold'; diff --git a/app_dart/lib/src/request_handlers/flush_cache.dart b/app_dart/lib/src/request_handlers/flush_cache.dart index ce60149b0..824a0c774 100644 --- a/app_dart/lib/src/request_handlers/flush_cache.dart +++ b/app_dart/lib/src/request_handlers/flush_cache.dart @@ -7,7 +7,6 @@ import 'dart:async'; import 'package:meta/meta.dart'; import '../request_handling/api_request_handler.dart'; -import '../request_handling/authentication.dart'; import '../request_handling/body.dart'; import '../request_handling/exceptions.dart'; import '../service/cache_service.dart'; @@ -19,11 +18,11 @@ import '../service/config.dart'; /// If the cache does not have the given key, throws [NotFoundException]. @immutable class FlushCache extends ApiRequestHandler { - const FlushCache( - Config config, - AuthenticationProvider authenticationProvider, { + const FlushCache({ + required super.config, + required super.authenticationProvider, required this.cache, - }) : super(config: config, authenticationProvider: authenticationProvider); + }); final CacheService cache; diff --git a/app_dart/lib/src/request_handlers/get_authentication_status.dart b/app_dart/lib/src/request_handlers/get_authentication_status.dart index 611e6798b..20e0dbbca 100644 --- a/app_dart/lib/src/request_handlers/get_authentication_status.dart +++ b/app_dart/lib/src/request_handlers/get_authentication_status.dart @@ -10,14 +10,13 @@ import '../request_handling/authentication.dart'; import '../request_handling/body.dart'; import '../request_handling/exceptions.dart'; import '../request_handling/request_handler.dart'; -import '../service/config.dart'; @immutable class GetAuthenticationStatus extends RequestHandler { - const GetAuthenticationStatus( - Config config, - this.authenticationProvider, - ) : super(config: config); + const GetAuthenticationStatus({ + required super.config, + required this.authenticationProvider, + }); final AuthenticationProvider authenticationProvider; diff --git a/app_dart/lib/src/request_handlers/get_branches.dart b/app_dart/lib/src/request_handlers/get_branches.dart index 9ff3d7e9e..a02057241 100644 --- a/app_dart/lib/src/request_handlers/get_branches.dart +++ b/app_dart/lib/src/request_handlers/get_branches.dart @@ -37,11 +37,11 @@ import '../service/datastore.dart'; ///] class GetBranches extends RequestHandler { - GetBranches( - Config config, { + GetBranches({ + required super.config, this.datastoreProvider = DatastoreService.defaultProvider, this.processRunner, - }) : super(config: config); + }); final DatastoreServiceProvider datastoreProvider; ProcessRunner? processRunner; diff --git a/app_dart/lib/src/request_handlers/get_build_status.dart b/app_dart/lib/src/request_handlers/get_build_status.dart index 6b32466b8..e4348426e 100644 --- a/app_dart/lib/src/request_handlers/get_build_status.dart +++ b/app_dart/lib/src/request_handlers/get_build_status.dart @@ -11,19 +11,16 @@ import '../../protos.dart' show BuildStatusResponse, EnumBuildStatus; import '../request_handling/body.dart'; import '../request_handling/request_handler.dart'; import '../service/build_status_provider.dart'; -import '../service/config.dart'; import '../service/datastore.dart'; @immutable class GetBuildStatus extends RequestHandler { - const GetBuildStatus( - Config config, { + const GetBuildStatus({ + required super.config, @visibleForTesting DatastoreServiceProvider? datastoreProvider, @visibleForTesting BuildStatusServiceProvider? buildStatusProvider, }) : datastoreProvider = datastoreProvider ?? DatastoreService.defaultProvider, - buildStatusProvider = buildStatusProvider ?? BuildStatusService.defaultProvider, - super(config: config); - + buildStatusProvider = buildStatusProvider ?? BuildStatusService.defaultProvider; final DatastoreServiceProvider datastoreProvider; final BuildStatusServiceProvider buildStatusProvider; diff --git a/app_dart/lib/src/request_handlers/get_green_commits.dart b/app_dart/lib/src/request_handlers/get_green_commits.dart index 259830232..e8a0ce7b2 100644 --- a/app_dart/lib/src/request_handlers/get_green_commits.dart +++ b/app_dart/lib/src/request_handlers/get_green_commits.dart @@ -34,12 +34,11 @@ import '../service/datastore.dart'; @immutable class GetGreenCommits extends RequestHandler { - const GetGreenCommits( - Config config, { + const GetGreenCommits({ + required super.config, @visibleForTesting this.datastoreProvider = DatastoreService.defaultProvider, @visibleForTesting BuildStatusServiceProvider? buildStatusProvider, - }) : buildStatusProvider = buildStatusProvider ?? BuildStatusService.defaultProvider, - super(config: config); + }) : buildStatusProvider = buildStatusProvider ?? BuildStatusService.defaultProvider; final DatastoreServiceProvider datastoreProvider; final BuildStatusServiceProvider buildStatusProvider; diff --git a/app_dart/lib/src/request_handlers/get_release_branches.dart b/app_dart/lib/src/request_handlers/get_release_branches.dart index a7abd81d4..b356dd06a 100644 --- a/app_dart/lib/src/request_handlers/get_release_branches.dart +++ b/app_dart/lib/src/request_handlers/get_release_branches.dart @@ -32,7 +32,7 @@ import '../service/config.dart'; ///] class GetReleaseBranches extends RequestHandler { - GetReleaseBranches(Config config, {required this.branchService}) : super(config: config); + GetReleaseBranches({required super.config, required this.branchService}); final BranchService branchService; diff --git a/app_dart/lib/src/request_handlers/get_repos.dart b/app_dart/lib/src/request_handlers/get_repos.dart index dcd419178..0366ab1d6 100644 --- a/app_dart/lib/src/request_handlers/get_repos.dart +++ b/app_dart/lib/src/request_handlers/get_repos.dart @@ -14,9 +14,9 @@ import '../service/config.dart'; /// Returns [Config.supportedRepos] as a list of repo names. @immutable class GetRepos extends RequestHandler { - const GetRepos( - Config config, - ) : super(config: config); + const GetRepos({ + required super.config, + }); @override Future get() async { diff --git a/app_dart/lib/src/request_handlers/get_status.dart b/app_dart/lib/src/request_handlers/get_status.dart index a421ad1b0..49ee363d8 100644 --- a/app_dart/lib/src/request_handlers/get_status.dart +++ b/app_dart/lib/src/request_handlers/get_status.dart @@ -19,12 +19,11 @@ import '../service/datastore.dart'; @immutable class GetStatus extends RequestHandler { - const GetStatus( - Config config, { + const GetStatus({ + required super.config, @visibleForTesting this.datastoreProvider = DatastoreService.defaultProvider, @visibleForTesting BuildStatusServiceProvider? buildStatusProvider, - }) : buildStatusProvider = buildStatusProvider ?? BuildStatusService.defaultProvider, - super(config: config); + }) : buildStatusProvider = buildStatusProvider ?? BuildStatusService.defaultProvider; final DatastoreServiceProvider datastoreProvider; final BuildStatusServiceProvider buildStatusProvider; diff --git a/app_dart/lib/src/request_handlers/github_rate_limit_status.dart b/app_dart/lib/src/request_handlers/github_rate_limit_status.dart index 201a8f7f3..c97b4c7e2 100644 --- a/app_dart/lib/src/request_handlers/github_rate_limit_status.dart +++ b/app_dart/lib/src/request_handlers/github_rate_limit_status.dart @@ -9,7 +9,6 @@ import 'package:meta/meta.dart'; import '../foundation/utils.dart'; import '../request_handling/body.dart'; import '../request_handling/request_handler.dart'; -import '../service/config.dart'; import '../service/github_service.dart'; @immutable @@ -26,7 +25,9 @@ import '../service/github_service.dart'; /// `remaining`: Total number of API calls remaining before flutter-dashboard is blocked from sending further requests. /// `resets`: [DateTime] when [remaining] will reset back to [limit]. class GithubRateLimitStatus extends RequestHandler { - const GithubRateLimitStatus(Config config) : super(config: config); + const GithubRateLimitStatus({ + required super.config, + }); @override Future get() async { diff --git a/app_dart/lib/src/request_handlers/github_webhook.dart b/app_dart/lib/src/request_handlers/github_webhook.dart index b7b670df8..cf1b87de4 100644 --- a/app_dart/lib/src/request_handlers/github_webhook.dart +++ b/app_dart/lib/src/request_handlers/github_webhook.dart @@ -38,13 +38,13 @@ final RegExp kEngineTestRegExp = RegExp(r'(tests?|benchmarks?)\.(dart|java|mm|m| final List kNeedsTestsLabels = ['needs tests']; class GithubWebhook extends RequestHandler { - GithubWebhook( - Config config, { + GithubWebhook({ + required super.config, required this.scheduler, this.githubChecksService, this.datastoreProvider = DatastoreService.defaultProvider, required this.branchService, - }) : super(config: config); + }); /// Cocoon scheduler to trigger tasks against changes from GitHub. final Scheduler scheduler; diff --git a/app_dart/lib/src/request_handlers/postsubmit_luci_subscription.dart b/app_dart/lib/src/request_handlers/postsubmit_luci_subscription.dart index 6fdec3c22..c13b12436 100644 --- a/app_dart/lib/src/request_handlers/postsubmit_luci_subscription.dart +++ b/app_dart/lib/src/request_handlers/postsubmit_luci_subscription.dart @@ -12,12 +12,9 @@ import 'package:meta/meta.dart'; import '../model/appengine/commit.dart'; import '../model/appengine/task.dart'; import '../model/luci/push_message.dart'; -import '../request_handling/authentication.dart'; import '../request_handling/body.dart'; import '../request_handling/exceptions.dart'; import '../request_handling/subscription_handler.dart'; -import '../service/cache_service.dart'; -import '../service/config.dart'; import '../service/datastore.dart'; import '../service/logging.dart'; import '../service/scheduler.dart'; @@ -32,18 +29,13 @@ import '../service/scheduler.dart'; class PostsubmitLuciSubscription extends SubscriptionHandler { /// Creates an endpoint for listening to LUCI status updates. const PostsubmitLuciSubscription({ - required CacheService cache, - required Config config, - AuthenticationProvider? authProvider, + required super.cache, + required super.config, + super.authProvider, @visibleForTesting this.datastoreProvider = DatastoreService.defaultProvider, required this.luciBuildService, required this.scheduler, - }) : super( - cache: cache, - config: config, - authProvider: authProvider, - topicName: 'luci-postsubmit', - ); + }) : super(topicName: 'luci-postsubmit'); final DatastoreServiceProvider datastoreProvider; final LuciBuildService luciBuildService; diff --git a/app_dart/lib/src/request_handlers/presubmit_luci_subscription.dart b/app_dart/lib/src/request_handlers/presubmit_luci_subscription.dart index 8c172231c..81632d483 100644 --- a/app_dart/lib/src/request_handlers/presubmit_luci_subscription.dart +++ b/app_dart/lib/src/request_handlers/presubmit_luci_subscription.dart @@ -12,8 +12,6 @@ import '../request_handling/authentication.dart'; import '../request_handling/body.dart'; import '../request_handling/subscription_handler.dart'; import '../service/buildbucket.dart'; -import '../service/cache_service.dart'; -import '../service/config.dart'; import '../service/github_checks_service.dart'; import '../service/logging.dart'; import '../service/luci_build_service.dart'; @@ -33,19 +31,14 @@ import '../service/luci_build_service.dart'; @immutable class PresubmitLuciSubscription extends SubscriptionHandler { /// Creates an endpoint for listening to LUCI status updates. - const PresubmitLuciSubscription( - CacheService cache, - Config config, - this.buildBucketClient, - this.luciBuildService, - this.githubChecksService, { + const PresubmitLuciSubscription({ + required super.cache, + required super.config, + required this.buildBucketClient, + required this.luciBuildService, + required this.githubChecksService, AuthenticationProvider? authProvider, - }) : super( - cache: cache, - config: config, - authProvider: authProvider, - topicName: 'github-updater', - ); + }) : super(topicName: 'github-updater'); final BuildBucketClient buildBucketClient; final LuciBuildService luciBuildService; diff --git a/app_dart/lib/src/request_handlers/push_build_status_to_github.dart b/app_dart/lib/src/request_handlers/push_build_status_to_github.dart index b16a1e67c..b6ff5ab25 100644 --- a/app_dart/lib/src/request_handlers/push_build_status_to_github.dart +++ b/app_dart/lib/src/request_handlers/push_build_status_to_github.dart @@ -16,14 +16,13 @@ import '../service/logging.dart'; @immutable class PushBuildStatusToGithub extends ApiRequestHandler { - const PushBuildStatusToGithub( - Config config, - AuthenticationProvider authenticationProvider, { + const PushBuildStatusToGithub({ + required super.config, + required super.authenticationProvider, @visibleForTesting DatastoreServiceProvider? datastoreProvider, @visibleForTesting BuildStatusServiceProvider? buildStatusServiceProvider, }) : datastoreProvider = datastoreProvider ?? DatastoreService.defaultProvider, - buildStatusServiceProvider = buildStatusServiceProvider ?? BuildStatusService.defaultProvider, - super(config: config, authenticationProvider: authenticationProvider); + buildStatusServiceProvider = buildStatusServiceProvider ?? BuildStatusService.defaultProvider; final BuildStatusServiceProvider buildStatusServiceProvider; final DatastoreServiceProvider datastoreProvider; diff --git a/app_dart/lib/src/request_handlers/push_gold_status_to_github.dart b/app_dart/lib/src/request_handlers/push_gold_status_to_github.dart index 1e61f850a..d0f34f6ca 100644 --- a/app_dart/lib/src/request_handlers/push_gold_status_to_github.dart +++ b/app_dart/lib/src/request_handlers/push_gold_status_to_github.dart @@ -14,7 +14,6 @@ import 'package:meta/meta.dart'; import '../model/appengine/github_gold_status_update.dart'; import '../request_handling/api_request_handler.dart'; -import '../request_handling/authentication.dart'; import '../request_handling/body.dart'; import '../request_handling/exceptions.dart'; import '../service/config.dart'; @@ -23,15 +22,14 @@ import '../service/logging.dart'; @immutable class PushGoldStatusToGithub extends ApiRequestHandler { - PushGoldStatusToGithub( - Config config, - AuthenticationProvider authenticationProvider, { + PushGoldStatusToGithub({ + required super.config, + required super.authenticationProvider, @visibleForTesting DatastoreServiceProvider? datastoreProvider, http.Client? goldClient, this.ingestionDelay = const Duration(seconds: 10), }) : datastoreProvider = datastoreProvider ?? DatastoreService.defaultProvider, - goldClient = goldClient ?? http.Client(), - super(config: config, authenticationProvider: authenticationProvider); + goldClient = goldClient ?? http.Client(); final DatastoreServiceProvider datastoreProvider; final http.Client goldClient; diff --git a/app_dart/lib/src/request_handlers/query_github_graphql.dart b/app_dart/lib/src/request_handlers/query_github_graphql.dart index 3fd73d0a4..9fa65063e 100644 --- a/app_dart/lib/src/request_handlers/query_github_graphql.dart +++ b/app_dart/lib/src/request_handlers/query_github_graphql.dart @@ -3,31 +3,24 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:typed_data'; import 'package:gql/language.dart' as lang; import 'package:graphql/client.dart'; import 'package:meta/meta.dart'; import '../request_handling/api_request_handler.dart'; -import '../request_handling/authentication.dart'; import '../request_handling/body.dart'; import '../request_handling/exceptions.dart'; -import '../service/config.dart'; import '../service/logging.dart'; /// Runs an authenticated Github GraphQl query returning the query result as json. @immutable class QueryGithubGraphql extends ApiRequestHandler { - const QueryGithubGraphql( - Config config, - AuthenticationProvider authenticationProvider, { - @visibleForTesting Uint8List? requestBodyValue, - }) : super( - config: config, - authenticationProvider: authenticationProvider, - requestBodyValue: requestBodyValue, - ); + const QueryGithubGraphql({ + required super.config, + required super.authenticationProvider, + @visibleForTesting super.requestBodyValue, + }); @override Future post() async { diff --git a/app_dart/lib/src/request_handlers/readiness_check.dart b/app_dart/lib/src/request_handlers/readiness_check.dart index 1de4dfe54..6c8ecbe9b 100644 --- a/app_dart/lib/src/request_handlers/readiness_check.dart +++ b/app_dart/lib/src/request_handlers/readiness_check.dart @@ -6,11 +6,10 @@ import 'dart:async'; import 'package:meta/meta.dart'; import '../request_handling/body.dart'; import '../request_handling/request_handler.dart'; -import '../service/config.dart'; @immutable class ReadinessCheck extends RequestHandler { - const ReadinessCheck({required Config config}) : super(config: config); + const ReadinessCheck({required super.config}); @override Future get() async { diff --git a/app_dart/lib/src/request_handlers/reset_prod_task.dart b/app_dart/lib/src/request_handlers/reset_prod_task.dart index 5ed5e14a7..dd6d524cd 100644 --- a/app_dart/lib/src/request_handlers/reset_prod_task.dart +++ b/app_dart/lib/src/request_handlers/reset_prod_task.dart @@ -15,7 +15,6 @@ import '../model/ci_yaml/ci_yaml.dart'; import '../model/ci_yaml/target.dart'; import '../model/google/token_info.dart'; import '../request_handling/api_request_handler.dart'; -import '../request_handling/authentication.dart'; import '../request_handling/body.dart'; import '../request_handling/exceptions.dart'; import '../service/config.dart'; @@ -29,14 +28,13 @@ import '../service/scheduler.dart'; /// Expects either [taskKeyParam] or a set of params that give enough detail to lookup a task in datastore. @immutable class ResetProdTask extends ApiRequestHandler { - const ResetProdTask( - Config config, - AuthenticationProvider authenticationProvider, - this.luciBuildService, - this.scheduler, { + const ResetProdTask({ + required super.config, + required super.authenticationProvider, + required this.luciBuildService, + required this.scheduler, @visibleForTesting DatastoreServiceProvider? datastoreProvider, - }) : datastoreProvider = datastoreProvider ?? DatastoreService.defaultProvider, - super(config: config, authenticationProvider: authenticationProvider); + }) : datastoreProvider = datastoreProvider ?? DatastoreService.defaultProvider; final DatastoreServiceProvider datastoreProvider; final LuciBuildService luciBuildService; diff --git a/app_dart/lib/src/request_handlers/reset_try_task.dart b/app_dart/lib/src/request_handlers/reset_try_task.dart index f8e1e6c9d..9d70698c2 100644 --- a/app_dart/lib/src/request_handlers/reset_try_task.dart +++ b/app_dart/lib/src/request_handlers/reset_try_task.dart @@ -15,11 +15,11 @@ import '../request_handling/exceptions.dart'; /// used to unblock rollers when creating a new commit is not possible. @immutable class ResetTryTask extends ApiRequestHandler { - const ResetTryTask( - Config config, - AuthenticationProvider authenticationProvider, - this.scheduler, - ) : super(config: config, authenticationProvider: authenticationProvider); + const ResetTryTask({ + required super.config, + required super.authenticationProvider, + required this.scheduler, + }); final Scheduler scheduler; diff --git a/app_dart/lib/src/request_handlers/scheduler/batch_backfiller.dart b/app_dart/lib/src/request_handlers/scheduler/batch_backfiller.dart index b7b17c622..eeef15b2a 100644 --- a/app_dart/lib/src/request_handlers/scheduler/batch_backfiller.dart +++ b/app_dart/lib/src/request_handlers/scheduler/batch_backfiller.dart @@ -14,7 +14,6 @@ import 'package:meta/meta.dart'; import '../../model/ci_yaml/ci_yaml.dart'; import '../../model/ci_yaml/target.dart'; import '../../request_handling/request_handler.dart'; -import '../../service/config.dart'; import '../../service/logging.dart'; import '../../service/luci_build_service.dart'; import '../../service/scheduler.dart'; @@ -26,10 +25,10 @@ import '../../service/scheduler.dart'; class BatchBackfiller extends RequestHandler { /// Creates a subscription for sending BuildBucket requests. const BatchBackfiller({ - required Config config, + required super.config, required this.scheduler, @visibleForTesting this.datastoreProvider = DatastoreService.defaultProvider, - }) : super(config: config); + }); final DatastoreServiceProvider datastoreProvider; final Scheduler scheduler; diff --git a/app_dart/lib/src/request_handlers/scheduler/request_subscription.dart b/app_dart/lib/src/request_handlers/scheduler/request_subscription.dart index e41a359fa..317279fbf 100644 --- a/app_dart/lib/src/request_handlers/scheduler/request_subscription.dart +++ b/app_dart/lib/src/request_handlers/scheduler/request_subscription.dart @@ -27,17 +27,12 @@ import '../../service/logging.dart'; class SchedulerRequestSubscription extends SubscriptionHandler { /// Creates a subscription for sending BuildBucket requests. const SchedulerRequestSubscription({ - required CacheService cache, - required Config config, + required super.cache, + required super.config, required this.buildBucketClient, - AuthenticationProvider? authProvider, + super.authProvider, this.retryOptions = Config.schedulerRetry, - }) : super( - cache: cache, - config: config, - authProvider: authProvider, - topicName: 'scheduler-requests', - ); + }) : super(topicName: 'scheduler-requests'); final BuildBucketClient buildBucketClient; diff --git a/app_dart/lib/src/request_handlers/update_branches.dart b/app_dart/lib/src/request_handlers/update_branches.dart index ddb31ac99..8943f8d75 100644 --- a/app_dart/lib/src/request_handlers/update_branches.dart +++ b/app_dart/lib/src/request_handlers/update_branches.dart @@ -42,11 +42,11 @@ import '../service/datastore.dart'; ///] class UpdateBranches extends RequestHandler { - UpdateBranches( - Config config, { + UpdateBranches({ + required super.config, this.datastoreProvider = DatastoreService.defaultProvider, this.processManager, - }) : super(config: config); + }); final DatastoreServiceProvider datastoreProvider; ProcessManager? processManager; diff --git a/app_dart/lib/src/request_handlers/update_existing_flaky_issues.dart b/app_dart/lib/src/request_handlers/update_existing_flaky_issues.dart index e9ddb3f4c..8c92cb145 100644 --- a/app_dart/lib/src/request_handlers/update_existing_flaky_issues.dart +++ b/app_dart/lib/src/request_handlers/update_existing_flaky_issues.dart @@ -12,7 +12,6 @@ import 'package:yaml/yaml.dart'; import '../../protos.dart' as pb; import '../foundation/utils.dart'; import '../request_handling/api_request_handler.dart'; -import '../request_handling/authentication.dart'; import '../request_handling/body.dart'; import '../service/bigquery.dart'; import '../service/config.dart'; @@ -26,8 +25,10 @@ import 'flaky_handler_utils.dart'; /// properly adjusts the priority labels. @immutable class UpdateExistingFlakyIssue extends ApiRequestHandler { - const UpdateExistingFlakyIssue(Config config, AuthenticationProvider authenticationProvider) - : super(config: config, authenticationProvider: authenticationProvider); + const UpdateExistingFlakyIssue({ + required super.config, + required super.authenticationProvider, + }); static const String kThresholdKey = 'threshold'; static const int kFreshPeriodForOpenFlake = 7; // days diff --git a/app_dart/lib/src/request_handlers/update_task_status.dart b/app_dart/lib/src/request_handlers/update_task_status.dart index 845a0a213..0a8ca3e56 100644 --- a/app_dart/lib/src/request_handlers/update_task_status.dart +++ b/app_dart/lib/src/request_handlers/update_task_status.dart @@ -10,10 +10,8 @@ import 'package:meta/meta.dart'; import '../model/appengine/commit.dart'; import '../model/appengine/task.dart'; import '../request_handling/api_request_handler.dart'; -import '../request_handling/authentication.dart'; import '../request_handling/body.dart'; import '../request_handling/exceptions.dart'; -import '../service/config.dart'; import '../service/datastore.dart'; import '../service/logging.dart'; @@ -29,11 +27,11 @@ import '../service/logging.dart'; /// B. Optional: [resultsParam] and [scoreKeysParam] which hold performance benchmark data. @immutable class UpdateTaskStatus extends ApiRequestHandler { - const UpdateTaskStatus( - Config config, - AuthenticationProvider authenticationProvider, { + const UpdateTaskStatus({ + required super.config, + required super.authenticationProvider, @visibleForTesting this.datastoreProvider = DatastoreService.defaultProvider, - }) : super(config: config, authenticationProvider: authenticationProvider); + }); final DatastoreServiceProvider datastoreProvider; diff --git a/app_dart/lib/src/request_handlers/vacuum_github_commits.dart b/app_dart/lib/src/request_handlers/vacuum_github_commits.dart index ed77def07..d1d93dbd0 100644 --- a/app_dart/lib/src/request_handlers/vacuum_github_commits.dart +++ b/app_dart/lib/src/request_handlers/vacuum_github_commits.dart @@ -11,7 +11,6 @@ import 'package:truncate/truncate.dart'; import '../model/appengine/commit.dart'; import '../request_handling/api_request_handler.dart'; -import '../request_handling/authentication.dart'; import '../request_handling/body.dart'; import '../service/config.dart'; import '../service/datastore.dart'; @@ -22,12 +21,12 @@ import '../service/scheduler.dart'; /// Query GitHub for commits from the past day and ensure they exist in datastore. @immutable class VacuumGithubCommits extends ApiRequestHandler { - const VacuumGithubCommits( - Config config, - AuthenticationProvider authenticationProvider, { + const VacuumGithubCommits({ + required super.config, + required super.authenticationProvider, required this.scheduler, @visibleForTesting this.datastoreProvider = DatastoreService.defaultProvider, - }) : super(config: config, authenticationProvider: authenticationProvider); + }); final DatastoreServiceProvider datastoreProvider; diff --git a/app_dart/lib/src/request_handling/api_request_handler.dart b/app_dart/lib/src/request_handling/api_request_handler.dart index de39d1df8..7447ad9bf 100644 --- a/app_dart/lib/src/request_handling/api_request_handler.dart +++ b/app_dart/lib/src/request_handling/api_request_handler.dart @@ -10,7 +10,6 @@ import 'dart:typed_data'; import 'package:meta/meta.dart'; import '../model/google/token_info.dart'; -import '../service/config.dart'; import 'authentication.dart'; import 'body.dart'; import 'exceptions.dart'; @@ -30,10 +29,10 @@ import 'request_handler.dart'; abstract class ApiRequestHandler extends RequestHandler { /// Creates a new [ApiRequestHandler]. const ApiRequestHandler({ - required Config config, + required super.config, required this.authenticationProvider, this.requestBodyValue, - }) : super(config: config); + }); /// Service responsible for authenticating this [HttpRequest]. final AuthenticationProvider authenticationProvider; diff --git a/app_dart/lib/src/request_handling/authentication.dart b/app_dart/lib/src/request_handling/authentication.dart index 6a68f75f4..69d2fd73d 100644 --- a/app_dart/lib/src/request_handling/authentication.dart +++ b/app_dart/lib/src/request_handling/authentication.dart @@ -50,8 +50,8 @@ import 'exceptions.dart'; /// * @immutable class AuthenticationProvider { - const AuthenticationProvider( - this.config, { + const AuthenticationProvider({ + required this.config, this.clientContextProvider = Providers.serviceScopeContext, this.httpClientProvider = Providers.freshHttpClient, }); diff --git a/app_dart/lib/src/request_handling/cache_request_handler.dart b/app_dart/lib/src/request_handling/cache_request_handler.dart index 590654fce..d0d587561 100644 --- a/app_dart/lib/src/request_handling/cache_request_handler.dart +++ b/app_dart/lib/src/request_handling/cache_request_handler.dart @@ -9,7 +9,6 @@ import 'package:meta/meta.dart'; import '../request_handling/request_handler.dart'; import '../service/cache_service.dart'; -import '../service/config.dart'; import 'body.dart'; /// A [RequestHandler] for serving cached responses. @@ -22,10 +21,10 @@ class CacheRequestHandler extends RequestHandler { /// Creates a new [CacheRequestHandler]. const CacheRequestHandler({ required this.delegate, - required Config config, + required super.config, required this.cache, this.ttl = const Duration(minutes: 1), - }) : super(config: config); + }); /// [RequestHandler] to fallback on for cache misses. final RequestHandler delegate; diff --git a/app_dart/lib/src/request_handling/no_auth_request_handler.dart b/app_dart/lib/src/request_handling/no_auth_request_handler.dart index fcd75dad9..bbe05e87d 100644 --- a/app_dart/lib/src/request_handling/no_auth_request_handler.dart +++ b/app_dart/lib/src/request_handling/no_auth_request_handler.dart @@ -9,7 +9,6 @@ import 'dart:typed_data'; import 'package:meta/meta.dart'; -import '../service/config.dart'; import 'body.dart'; import 'exceptions.dart'; import 'request_handler.dart'; @@ -26,8 +25,8 @@ import 'request_handler.dart'; abstract class NoAuthRequestHandler extends RequestHandler { /// Creates a new [NoAuthRequestHandler]. const NoAuthRequestHandler({ - required Config config, - }) : super(config: config); + required super.config, + }); /// Throws a [BadRequestException] if any of [requiredParameters] is missing /// from [requestData]. diff --git a/app_dart/lib/src/request_handling/pubsub_authentication.dart b/app_dart/lib/src/request_handling/pubsub_authentication.dart index eea406bd8..82dacfbb0 100644 --- a/app_dart/lib/src/request_handling/pubsub_authentication.dart +++ b/app_dart/lib/src/request_handling/pubsub_authentication.dart @@ -12,7 +12,6 @@ import 'package:meta/meta.dart'; import '../../cocoon_service.dart'; import '../foundation/providers.dart'; -import '../foundation/typedefs.dart'; import '../service/logging.dart'; import 'exceptions.dart'; @@ -28,15 +27,11 @@ import 'exceptions.dart'; /// If there is no token, or it cannot be authenticated, [Unauthenticated] is thrown. @immutable class PubsubAuthenticationProvider extends AuthenticationProvider { - const PubsubAuthenticationProvider( - Config config, { - ClientContextProvider clientContextProvider = Providers.serviceScopeContext, - HttpClientProvider httpClientProvider = Providers.freshHttpClient, - }) : super( - config, - clientContextProvider: clientContextProvider, - httpClientProvider: httpClientProvider, - ); + const PubsubAuthenticationProvider({ + required super.config, + super.clientContextProvider = Providers.serviceScopeContext, + super.httpClientProvider = Providers.freshHttpClient, + }); static const String kBearerTokenPrefix = 'Bearer '; diff --git a/app_dart/lib/src/request_handling/static_file_handler.dart b/app_dart/lib/src/request_handling/static_file_handler.dart index 7bbe0f6e8..9fcb46136 100644 --- a/app_dart/lib/src/request_handling/static_file_handler.dart +++ b/app_dart/lib/src/request_handling/static_file_handler.dart @@ -19,8 +19,11 @@ import 'exceptions.dart'; @immutable class StaticFileHandler extends RequestHandler { /// Creates a new [StaticFileHandler]. - const StaticFileHandler(this.filePath, {required Config config, this.fs = const LocalFileSystem()}) - : super(config: config); + const StaticFileHandler( + this.filePath, { + required super.config, + this.fs = const LocalFileSystem(), + }); /// The current [FileSystem] to retrieve files from. final FileSystem fs; diff --git a/app_dart/lib/src/request_handling/subscription_handler.dart b/app_dart/lib/src/request_handling/subscription_handler.dart index 1e5f967a1..ee2242cab 100644 --- a/app_dart/lib/src/request_handling/subscription_handler.dart +++ b/app_dart/lib/src/request_handling/subscription_handler.dart @@ -10,7 +10,6 @@ import 'package:meta/meta.dart'; import '../model/luci/push_message.dart'; import '../service/cache_service.dart'; -import '../service/config.dart'; import '../service/logging.dart'; import 'api_request_handler.dart'; import 'authentication.dart'; @@ -30,12 +29,10 @@ abstract class SubscriptionHandler extends RequestHandler { /// Creates a new [SubscriptionHandler]. const SubscriptionHandler({ required this.cache, - required Config config, + required super.config, this.authProvider, required this.topicName, - }) : super( - config: config, - ); + }); final CacheService cache; @@ -62,7 +59,7 @@ abstract class SubscriptionHandler extends RequestHandler { Future Function(HttpStatusException)? onError, }) async { AuthenticatedContext authContext; - final AuthenticationProvider _authProvider = authProvider ?? PubsubAuthenticationProvider(config); + final AuthenticationProvider _authProvider = authProvider ?? PubsubAuthenticationProvider(config: config); try { authContext = await _authProvider.authenticate(request); } on Unauthenticated catch (error) { diff --git a/app_dart/lib/src/request_handling/swarming_authentication.dart b/app_dart/lib/src/request_handling/swarming_authentication.dart index bf4bbe683..a6d9ce02b 100644 --- a/app_dart/lib/src/request_handling/swarming_authentication.dart +++ b/app_dart/lib/src/request_handling/swarming_authentication.dart @@ -12,7 +12,6 @@ import 'package:meta/meta.dart'; import '../../cocoon_service.dart'; import '../foundation/providers.dart'; -import '../foundation/typedefs.dart'; import '../model/google/token_info.dart'; import '../service/logging.dart'; import 'exceptions.dart'; @@ -31,15 +30,11 @@ import 'exceptions.dart'; /// [authenticate] will throw an [Unauthenticated] exception. @immutable class SwarmingAuthenticationProvider extends AuthenticationProvider { - const SwarmingAuthenticationProvider( - Config config, { - ClientContextProvider clientContextProvider = Providers.serviceScopeContext, - HttpClientProvider httpClientProvider = Providers.freshHttpClient, - }) : super( - config, - clientContextProvider: clientContextProvider, - httpClientProvider: httpClientProvider, - ); + const SwarmingAuthenticationProvider({ + required super.config, + super.clientContextProvider = Providers.serviceScopeContext, + super.httpClientProvider = Providers.freshHttpClient, + }); /// Name of the header that LUCI requests will put their service account token. static const String kSwarmingTokenHeader = 'Service-Account-Token'; diff --git a/app_dart/lib/src/service/luci_build_service.dart b/app_dart/lib/src/service/luci_build_service.dart index 4762f584d..edd440eea 100644 --- a/app_dart/lib/src/service/luci_build_service.dart +++ b/app_dart/lib/src/service/luci_build_service.dart @@ -31,9 +31,9 @@ const Set taskFailStatusSet = {Task.statusInfraFailure, Task.sta /// and cancel builds for github repos. It uses [config.luciTryBuilders] to /// get the list of available builders. class LuciBuildService { - LuciBuildService( - this.config, - this.buildBucketClient, { + LuciBuildService({ + required this.config, + required this.buildBucketClient, GithubChecksUtil? githubChecksUtil, GerritService? gerritService, this.pubsub = const PubSub(), diff --git a/app_dart/pubspec.lock b/app_dart/pubspec.lock index f964e2dc0..1f3b8ecea 100644 --- a/app_dart/pubspec.lock +++ b/app_dart/pubspec.lock @@ -737,4 +737,4 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.14.0 <3.0.0" + dart: ">=2.17.0 <3.0.0" diff --git a/app_dart/pubspec.yaml b/app_dart/pubspec.yaml index 3f596993d..92b92032b 100644 --- a/app_dart/pubspec.yaml +++ b/app_dart/pubspec.yaml @@ -8,7 +8,7 @@ homepage: https://github.com/flutter/cocoon publish_to: none environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.17.0 <3.0.0' dependencies: appengine: ^0.13.2 diff --git a/app_dart/test/request_handlers/check_flaky_builders_test.dart b/app_dart/test/request_handlers/check_flaky_builders_test.dart index ea9d42390..56a7fb3a1 100644 --- a/app_dart/test/request_handlers/check_flaky_builders_test.dart +++ b/app_dart/test/request_handlers/check_flaky_builders_test.dart @@ -117,8 +117,8 @@ void main() { tester = ApiRequestHandlerTester(request: request); handler = CheckFlakyBuilders( - config, - auth, + config: config, + authenticationProvider: auth, ); }); diff --git a/app_dart/test/request_handlers/file_flaky_issue_and_pr_test.dart b/app_dart/test/request_handlers/file_flaky_issue_and_pr_test.dart index 6cec47c6f..1cba761e7 100644 --- a/app_dart/test/request_handlers/file_flaky_issue_and_pr_test.dart +++ b/app_dart/test/request_handlers/file_flaky_issue_and_pr_test.dart @@ -122,8 +122,8 @@ void main() { tester = ApiRequestHandlerTester(request: request); handler = FileFlakyIssueAndPR( - config, - auth, + config: config, + authenticationProvider: auth, ); }); diff --git a/app_dart/test/request_handlers/flush_cache_test.dart b/app_dart/test/request_handlers/flush_cache_test.dart index 5ae09627f..05e65f088 100644 --- a/app_dart/test/request_handlers/flush_cache_test.dart +++ b/app_dart/test/request_handlers/flush_cache_test.dart @@ -27,8 +27,8 @@ void main() { cache = CacheService(inMemory: true); config = FakeConfig(); handler = FlushCache( - config, - FakeAuthenticationProvider(), + config: config, + authenticationProvider: FakeAuthenticationProvider(), cache: cache, ); }); diff --git a/app_dart/test/request_handlers/get_branches_test.dart b/app_dart/test/request_handlers/get_branches_test.dart index e2315ec7c..ce2ec6dff 100644 --- a/app_dart/test/request_handlers/get_branches_test.dart +++ b/app_dart/test/request_handlers/get_branches_test.dart @@ -43,7 +43,7 @@ void main() { keyHelperValue: keyHelper, ); handler = GetBranches( - config, + config: config, datastoreProvider: (DatastoreDB db) => DatastoreService(config.db, 5), ); diff --git a/app_dart/test/request_handlers/get_green_commits_test.dart b/app_dart/test/request_handlers/get_green_commits_test.dart index 9377d51eb..fd2ea0b2f 100644 --- a/app_dart/test/request_handlers/get_green_commits_test.dart +++ b/app_dart/test/request_handlers/get_green_commits_test.dart @@ -67,7 +67,7 @@ void main() { config = FakeConfig(keyHelperValue: keyHelper); buildStatusService = FakeBuildStatusService(commitStatuses: []); handler = GetGreenCommits( - config, + config: config, datastoreProvider: (DatastoreDB db) => DatastoreService(config.db, 5), buildStatusProvider: (_) => buildStatusService, ); @@ -84,7 +84,7 @@ void main() { CommitStatus(commit2, [stageOneSucceed, stageMultipleSucceed]) ]); handler = GetGreenCommits( - config, + config: config, datastoreProvider: (DatastoreDB db) => DatastoreService(config.db, 5), buildStatusProvider: (_) => buildStatusService, ); @@ -104,7 +104,7 @@ void main() { CommitStatus(commit2, [stageOneSucceed, stageMultipleSucceed]) ]); handler = GetGreenCommits( - config, + config: config, datastoreProvider: (DatastoreDB db) => DatastoreService(config.db, 5), buildStatusProvider: (_) => buildStatusService, ); @@ -121,7 +121,7 @@ void main() { CommitStatus(commit2, [stageFailedFlaky]) ]); handler = GetGreenCommits( - config, + config: config, datastoreProvider: (DatastoreDB db) => DatastoreService(config.db, 5), buildStatusProvider: (_) => buildStatusService, ); @@ -138,7 +138,7 @@ void main() { CommitStatus(commit2, [stageOneSucceed, stageFailedFlaky]) ]); handler = GetGreenCommits( - config, + config: config, datastoreProvider: (DatastoreDB db) => DatastoreService(config.db, 5), buildStatusProvider: (_) => buildStatusService, ); @@ -160,7 +160,7 @@ void main() { GetGreenCommits.kBranchParam: commitBranched.branch!, }); handler = GetGreenCommits( - config, + config: config, datastoreProvider: (DatastoreDB db) => DatastoreService(config.db, 5), buildStatusProvider: (_) => buildStatusService, ); diff --git a/app_dart/test/request_handlers/get_status_test.dart b/app_dart/test/request_handlers/get_status_test.dart index 0902acb67..efb5630cf 100644 --- a/app_dart/test/request_handlers/get_status_test.dart +++ b/app_dart/test/request_handlers/get_status_test.dart @@ -43,7 +43,7 @@ void main() { config = FakeConfig(keyHelperValue: keyHelper); buildStatusService = FakeBuildStatusService(commitStatuses: []); handler = GetStatus( - config, + config: config, datastoreProvider: (DatastoreDB db) => DatastoreService(config.db, 5), buildStatusProvider: (_) => buildStatusService, ); @@ -76,7 +76,7 @@ void main() { CommitStatus(commit2, const []) ]); handler = GetStatus( - config, + config: config, datastoreProvider: (DatastoreDB db) => DatastoreService(config.db, 5), buildStatusProvider: (_) => buildStatusService, ); @@ -108,7 +108,7 @@ void main() { CommitStatus(commit2, const []) ]); handler = GetStatus( - config, + config: config, datastoreProvider: (DatastoreDB db) => DatastoreService(config.db, 5), buildStatusProvider: (_) => buildStatusService, ); @@ -149,7 +149,7 @@ void main() { CommitStatus(commit2, const []) ]); handler = GetStatus( - config, + config: config, datastoreProvider: (DatastoreDB db) => DatastoreService(config.db, 5), buildStatusProvider: (_) => buildStatusService, ); diff --git a/app_dart/test/request_handlers/github_webhook_test.dart b/app_dart/test/request_handlers/github_webhook_test.dart index 68b994d0e..9ff10c881 100644 --- a/app_dart/test/request_handlers/github_webhook_test.dart +++ b/app_dart/test/request_handlers/github_webhook_test.dart @@ -100,7 +100,7 @@ void main() { }); webhook = GithubWebhook( - config, + config: config, datastoreProvider: (_) => DatastoreService(config.db, 5), githubChecksService: mockGithubChecksService, scheduler: scheduler, diff --git a/app_dart/test/request_handlers/postsubmit_luci_subscription_test.dart b/app_dart/test/request_handlers/postsubmit_luci_subscription_test.dart index 0fb38c493..b87d5e0a9 100644 --- a/app_dart/test/request_handlers/postsubmit_luci_subscription_test.dart +++ b/app_dart/test/request_handlers/postsubmit_luci_subscription_test.dart @@ -32,7 +32,7 @@ void main() { config: config, authProvider: FakeAuthenticationProvider(), datastoreProvider: (_) => DatastoreService(config.db, 5), - luciBuildService: FakeLuciBuildService(config), + luciBuildService: FakeLuciBuildService(config: config), scheduler: FakeScheduler( ciYaml: exampleConfig, config: config, diff --git a/app_dart/test/request_handlers/presubmit_luci_subscription_test.dart b/app_dart/test/request_handlers/presubmit_luci_subscription_test.dart index 4b3353928..9f4323ea9 100644 --- a/app_dart/test/request_handlers/presubmit_luci_subscription_test.dart +++ b/app_dart/test/request_handlers/presubmit_luci_subscription_test.dart @@ -33,11 +33,11 @@ void main() { mockGithubChecksService = MockGithubChecksService(); handler = PresubmitLuciSubscription( - CacheService(inMemory: true), - config, - buildbucket, - FakeLuciBuildService(config), - mockGithubChecksService, + cache: CacheService(inMemory: true), + config: config, + buildBucketClient: buildbucket, + luciBuildService: FakeLuciBuildService(config: config), + githubChecksService: mockGithubChecksService, authProvider: FakeAuthenticationProvider(), ); request = FakeHttpRequest(); diff --git a/app_dart/test/request_handlers/push_build_status_to_github_test.dart b/app_dart/test/request_handlers/push_build_status_to_github_test.dart index c5f168c48..ba8a4b5a3 100644 --- a/app_dart/test/request_handlers/push_build_status_to_github_test.dart +++ b/app_dart/test/request_handlers/push_build_status_to_github_test.dart @@ -71,8 +71,8 @@ void main() { ); tester = ApiRequestHandlerTester(context: authContext); handler = PushBuildStatusToGithub( - config, - FakeAuthenticationProvider(clientContext: clientContext), + config: config, + authenticationProvider: FakeAuthenticationProvider(clientContext: clientContext), buildStatusServiceProvider: (_) => buildStatusService, datastoreProvider: (DatastoreDB db) => DatastoreService(config.db, 5), ); diff --git a/app_dart/test/request_handlers/push_gold_status_to_github_test.dart b/app_dart/test/request_handlers/push_gold_status_to_github_test.dart index ddb16710e..c661743d3 100644 --- a/app_dart/test/request_handlers/push_gold_status_to_github_test.dart +++ b/app_dart/test/request_handlers/push_gold_status_to_github_test.dart @@ -87,8 +87,8 @@ void main() { config.flutterGoldStalePRValue = 'stale'; handler = PushGoldStatusToGithub( - config, - auth, + config: config, + authenticationProvider: auth, datastoreProvider: (DatastoreDB db) { return DatastoreService( db, @@ -403,8 +403,8 @@ void main() { throw const HttpException('Unexpected http request'); }); handler = PushGoldStatusToGithub( - config, - auth, + config: config, + authenticationProvider: auth, datastoreProvider: (DatastoreDB db) { return DatastoreService( config.db, @@ -771,8 +771,8 @@ void main() { throw const HttpException('Unexpected http request'); }); handler = PushGoldStatusToGithub( - config, - auth, + config: config, + authenticationProvider: auth, datastoreProvider: (DatastoreDB db) { return DatastoreService( config.db, @@ -828,8 +828,8 @@ void main() { throw const HttpException('Unexpected http request'); }); handler = PushGoldStatusToGithub( - config, - auth, + config: config, + authenticationProvider: auth, datastoreProvider: (DatastoreDB db) { return DatastoreService( config.db, @@ -894,8 +894,8 @@ void main() { throw const HttpException('Unexpected http request'); }); handler = PushGoldStatusToGithub( - config, - auth, + config: config, + authenticationProvider: auth, datastoreProvider: (DatastoreDB db) { return DatastoreService( config.db, @@ -958,8 +958,8 @@ void main() { throw const HttpException('Unexpected http request'); }); handler = PushGoldStatusToGithub( - config, - auth, + config: config, + authenticationProvider: auth, datastoreProvider: (DatastoreDB db) { return DatastoreService( config.db, @@ -1032,8 +1032,8 @@ void main() { throw const HttpException('Unexpected http request'); }); handler = PushGoldStatusToGithub( - config, - auth, + config: config, + authenticationProvider: auth, datastoreProvider: (DatastoreDB db) { return DatastoreService( config.db, @@ -1221,8 +1221,8 @@ void main() { throw const HttpException('Unexpected http request'); }); handler = PushGoldStatusToGithub( - config, - auth, + config: config, + authenticationProvider: auth, datastoreProvider: (DatastoreDB db) { return DatastoreService( config.db, @@ -1332,8 +1332,8 @@ void main() { return http.Response(tryjobDigests(requestedPr), HttpStatus.ok); }); handler = PushGoldStatusToGithub( - config, - auth, + config: config, + authenticationProvider: auth, datastoreProvider: (DatastoreDB db) { return DatastoreService( config.db, diff --git a/app_dart/test/request_handlers/query_github_graphql_test.dart b/app_dart/test/request_handlers/query_github_graphql_test.dart index 84377be61..1150bcc79 100644 --- a/app_dart/test/request_handlers/query_github_graphql_test.dart +++ b/app_dart/test/request_handlers/query_github_graphql_test.dart @@ -36,16 +36,16 @@ void main() { graphqlClient = FakeGraphQLClient(); config = FakeConfig(githubGraphQLClient: graphqlClient); handler = QueryGithubGraphql( - config, - FakeAuthenticationProvider(), + config: config, + authenticationProvider: FakeAuthenticationProvider(), requestBodyValue: utf8.encode(graphQLHelloWorld) as Uint8List, ); }); test('Empty body raises a bad request exception', () async { handler = QueryGithubGraphql( - config, - FakeAuthenticationProvider(), + config: config, + authenticationProvider: FakeAuthenticationProvider(), requestBodyValue: utf8.encode('') as Uint8List, ); expect(() => tester.post(handler), throwsA(isA())); diff --git a/app_dart/test/request_handlers/reset_prod_task_test.dart b/app_dart/test/request_handlers/reset_prod_task_test.dart index a0d473047..1e3759729 100644 --- a/app_dart/test/request_handlers/reset_prod_task_test.dart +++ b/app_dart/test/request_handlers/reset_prod_task_test.dart @@ -45,10 +45,10 @@ void main() { tester = ApiRequestHandlerTester(context: authContext); mockLuciBuildService = MockLuciBuildService(); handler = ResetProdTask( - config, - FakeAuthenticationProvider(clientContext: clientContext), - mockLuciBuildService, - FakeScheduler( + config: config, + authenticationProvider: FakeAuthenticationProvider(clientContext: clientContext), + luciBuildService: mockLuciBuildService, + scheduler: FakeScheduler( config: config, ciYaml: exampleConfig, ), diff --git a/app_dart/test/request_handlers/reset_try_task_test.dart b/app_dart/test/request_handlers/reset_try_task_test.dart index aff41f1e3..f5b6d5eb6 100644 --- a/app_dart/test/request_handlers/reset_try_task_test.dart +++ b/app_dart/test/request_handlers/reset_try_task_test.dart @@ -44,9 +44,9 @@ void main() { githubChecksUtil: mockGithubChecksUtil, ); handler = ResetTryTask( - config, - FakeAuthenticationProvider(clientContext: clientContext), - fakeScheduler, + config: config, + authenticationProvider: FakeAuthenticationProvider(clientContext: clientContext), + scheduler: fakeScheduler, ); when(mockGithub.pullRequests).thenReturn(mockPullRequestsService); when(mockPullRequestsService.get(any, 123)).thenAnswer((_) async => generatePullRequest(id: 123)); diff --git a/app_dart/test/request_handlers/scheduler/batch_backfiller_test.dart b/app_dart/test/request_handlers/scheduler/batch_backfiller_test.dart index e1585578a..6235da543 100644 --- a/app_dart/test/request_handlers/scheduler/batch_backfiller_test.dart +++ b/app_dart/test/request_handlers/scheduler/batch_backfiller_test.dart @@ -38,7 +38,7 @@ void main() { config: config, ciYaml: batchPolicyConfig, luciBuildService: FakeLuciBuildService( - config, + config: config, pubsub: pubsub, ), ); diff --git a/app_dart/test/request_handlers/update_branches_test.dart b/app_dart/test/request_handlers/update_branches_test.dart index fa299271e..5d3990936 100644 --- a/app_dart/test/request_handlers/update_branches_test.dart +++ b/app_dart/test/request_handlers/update_branches_test.dart @@ -55,7 +55,7 @@ void main() { config = FakeConfig(dbValue: db, keyHelperValue: keyHelper, githubClient: mockGitHubClient); handler = UpdateBranches( - config, + config: config, datastoreProvider: (DatastoreDB db) => DatastoreService(config.db, 5), processManager: processManager, ); diff --git a/app_dart/test/request_handlers/update_existing_flaky_issues_test.dart b/app_dart/test/request_handlers/update_existing_flaky_issues_test.dart index b2a8f847a..5edad67bf 100644 --- a/app_dart/test/request_handlers/update_existing_flaky_issues_test.dart +++ b/app_dart/test/request_handlers/update_existing_flaky_issues_test.dart @@ -79,8 +79,8 @@ void main() { tester = ApiRequestHandlerTester(request: request); handler = UpdateExistingFlakyIssue( - config, - auth, + config: config, + authenticationProvider: auth, ); }); diff --git a/app_dart/test/request_handlers/update_task_status_test.dart b/app_dart/test/request_handlers/update_task_status_test.dart index 2b38cb98b..57d979178 100644 --- a/app_dart/test/request_handlers/update_task_status_test.dart +++ b/app_dart/test/request_handlers/update_task_status_test.dart @@ -37,8 +37,8 @@ void main() { ); tester = ApiRequestHandlerTester(); handler = UpdateTaskStatus( - config, - FakeAuthenticationProvider(), + config: config, + authenticationProvider: FakeAuthenticationProvider(), datastoreProvider: (DatastoreDB db) => DatastoreService(config.db, 5), ); commit = Commit( diff --git a/app_dart/test/request_handlers/vacuum_github_commits_test.dart b/app_dart/test/request_handlers/vacuum_github_commits_test.dart index a0bad8732..58ec920d7 100644 --- a/app_dart/test/request_handlers/vacuum_github_commits_test.dart +++ b/app_dart/test/request_handlers/vacuum_github_commits_test.dart @@ -93,8 +93,8 @@ void main() { ); tester = ApiRequestHandlerTester(); handler = VacuumGithubCommits( - config, - auth, + config: config, + authenticationProvider: auth, datastoreProvider: (DatastoreDB db) => DatastoreService(config.db, 5), scheduler: scheduler, ); diff --git a/app_dart/test/request_handling/authentication_test.dart b/app_dart/test/request_handling/authentication_test.dart index d5ed87caf..5b0a93217 100644 --- a/app_dart/test/request_handling/authentication_test.dart +++ b/app_dart/test/request_handling/authentication_test.dart @@ -32,7 +32,7 @@ void main() { clientContext = FakeClientContext(); request = FakeHttpRequest(); auth = AuthenticationProvider( - config, + config: config, clientContextProvider: () => clientContext, httpClientProvider: () => throw AssertionError(), ); @@ -53,7 +53,7 @@ void main() { setUp(() { auth = AuthenticationProvider( - config, + config: config, clientContextProvider: () => clientContext, httpClientProvider: () => httpClient, ); @@ -62,7 +62,7 @@ void main() { test('auth succeeds with authenticated header', () async { httpClient = MockClient((_) async => http.Response('{"aud": "client-id", "hd": "google.com"}', HttpStatus.ok)); auth = AuthenticationProvider( - config, + config: config, clientContextProvider: () => clientContext, httpClientProvider: () => httpClient, ); diff --git a/app_dart/test/request_handling/pubsub_authentication_test.dart b/app_dart/test/request_handling/pubsub_authentication_test.dart index 37d07db1b..f7d5174df 100644 --- a/app_dart/test/request_handling/pubsub_authentication_test.dart +++ b/app_dart/test/request_handling/pubsub_authentication_test.dart @@ -29,7 +29,7 @@ void main() { clientContext = FakeClientContext(); request = FakeHttpRequest(); auth = PubsubAuthenticationProvider( - config, + config: config, clientContextProvider: () => clientContext, httpClientProvider: () => httpClient, ); @@ -45,7 +45,7 @@ void main() { }, )); auth = PubsubAuthenticationProvider( - config, + config: config, clientContextProvider: () => clientContext, httpClientProvider: () => httpClient, ); @@ -66,7 +66,7 @@ void main() { }, )); auth = PubsubAuthenticationProvider( - config, + config: config, clientContextProvider: () => clientContext, httpClientProvider: () => httpClient, ); @@ -85,7 +85,7 @@ void main() { }, )); auth = PubsubAuthenticationProvider( - config, + config: config, clientContextProvider: () => clientContext, httpClientProvider: () => httpClient, ); @@ -107,7 +107,7 @@ void main() { }, )); auth = PubsubAuthenticationProvider( - config, + config: config, clientContextProvider: () => clientContext, httpClientProvider: () => httpClient, ); diff --git a/app_dart/test/request_handling/swarming_authentication_test.dart b/app_dart/test/request_handling/swarming_authentication_test.dart index e2baa9b82..80ce5f833 100644 --- a/app_dart/test/request_handling/swarming_authentication_test.dart +++ b/app_dart/test/request_handling/swarming_authentication_test.dart @@ -28,7 +28,7 @@ void main() { clientContext = FakeClientContext(); request = FakeHttpRequest(); auth = SwarmingAuthenticationProvider( - config, + config: config, clientContextProvider: () => clientContext, ); }); @@ -43,7 +43,7 @@ void main() { setUp(() { auth = SwarmingAuthenticationProvider( - config, + config: config, clientContextProvider: () => clientContext, httpClientProvider: () => httpClient, ); @@ -52,7 +52,7 @@ void main() { test('auth succeeds with flutter luci service account', () async { httpClient = MockClient((_) async => http.Response('{"email": "${Config.luciProdAccount}"}', HttpStatus.ok)); auth = SwarmingAuthenticationProvider( - config, + config: config, clientContextProvider: () => clientContext, httpClientProvider: () => httpClient, ); @@ -66,7 +66,7 @@ void main() { test('auth succeeds with frob service account', () async { httpClient = MockClient((_) async => http.Response('{"email": "${Config.frobAccount}"}', HttpStatus.ok)); auth = SwarmingAuthenticationProvider( - config, + config: config, clientContextProvider: () => clientContext, httpClientProvider: () => httpClient, ); @@ -79,7 +79,7 @@ void main() { test('auth fails with non-luci service account', () async { httpClient = MockClient((_) async => http.Response('{"email": "abc@gmail.com"}', HttpStatus.ok)); auth = SwarmingAuthenticationProvider( - config, + config: config, clientContextProvider: () => clientContext, httpClientProvider: () => httpClient, ); @@ -92,7 +92,7 @@ void main() { test('auth fails with unauthenticated service account token', () async { httpClient = MockClient((_) async => http.Response('Invalid token', HttpStatus.unauthorized)); auth = SwarmingAuthenticationProvider( - config, + config: config, clientContextProvider: () => clientContext, httpClientProvider: () => httpClient, ); diff --git a/app_dart/test/service/luci_build_service_test.dart b/app_dart/test/service/luci_build_service_test.dart index d5fc216ae..900f7667d 100644 --- a/app_dart/test/service/luci_build_service_test.dart +++ b/app_dart/test/service/luci_build_service_test.dart @@ -53,8 +53,8 @@ void main() { mockBuildBucketClient = MockBuildBucketClient(); pubsub = FakePubSub(); service = LuciBuildService( - config, - mockBuildBucketClient, + config: config, + buildBucketClient: mockBuildBucketClient, gerritService: FakeGerritService(), pubsub: pubsub, ); @@ -129,8 +129,8 @@ void main() { mockBuildBucketClient = MockBuildBucketClient(); pubsub = FakePubSub(); service = LuciBuildService( - config, - mockBuildBucketClient, + config: config, + buildBucketClient: mockBuildBucketClient, gerritService: FakeGerritService(), pubsub: pubsub, ); @@ -183,8 +183,8 @@ void main() { mockBuildBucketClient = MockBuildBucketClient(); pubsub = FakePubSub(); service = LuciBuildService( - config, - mockBuildBucketClient, + config: config, + buildBucketClient: mockBuildBucketClient, pubsub: pubsub, ); slug = RepositorySlug('flutter', 'cocoon'); @@ -235,8 +235,8 @@ void main() { mockBuildBucketClient = MockBuildBucketClient(); pubsub = FakePubSub(); service = LuciBuildService( - config, - mockBuildBucketClient, + config: config, + buildBucketClient: mockBuildBucketClient, githubChecksUtil: mockGithubChecksUtil, gerritService: FakeGerritService(branchesValue: ['master']), pubsub: pubsub, @@ -406,8 +406,8 @@ void main() { mockBuildBucketClient = MockBuildBucketClient(); pubsub = FakePubSub(); service = LuciBuildService( - FakeConfig(), - mockBuildBucketClient, + config: FakeConfig(), + buildBucketClient: mockBuildBucketClient, pubsub: pubsub, ); }); @@ -507,8 +507,8 @@ void main() { mockBuildBucketClient = MockBuildBucketClient(); pubsub = FakePubSub(); service = LuciBuildService( - config, - mockBuildBucketClient, + config: config, + buildBucketClient: mockBuildBucketClient, pubsub: pubsub, ); slug = RepositorySlug('flutter', 'cocoon'); @@ -557,8 +557,8 @@ void main() { mockBuildBucketClient = MockBuildBucketClient(); pubsub = FakePubSub(); service = LuciBuildService( - config, - mockBuildBucketClient, + config: config, + buildBucketClient: mockBuildBucketClient, pubsub: pubsub, ); slug = RepositorySlug('flutter', 'flutter'); @@ -598,8 +598,8 @@ void main() { mockBuildBucketClient = MockBuildBucketClient(); pubsub = FakePubSub(); service = LuciBuildService( - config, - mockBuildBucketClient, + config: config, + buildBucketClient: mockBuildBucketClient, pubsub: pubsub, ); final Map json = jsonDecode(buildPushMessageString( @@ -632,8 +632,8 @@ void main() { mockBuildBucketClient = MockBuildBucketClient(); pubsub = FakePubSub(); service = LuciBuildService( - config, - mockBuildBucketClient, + config: config, + buildBucketClient: mockBuildBucketClient, pubsub: pubsub, ); datastore = DatastoreService(config.db, 5); diff --git a/app_dart/test/service/scheduler_test.dart b/app_dart/test/service/scheduler_test.dart index 6e5742ef1..2e53d212c 100644 --- a/app_dart/test/service/scheduler_test.dart +++ b/app_dart/test/service/scheduler_test.dart @@ -122,7 +122,7 @@ void main() { githubChecksService: GithubChecksService(config, githubChecksUtil: mockGithubChecksUtil), httpClientProvider: () => httpClient, luciBuildService: FakeLuciBuildService( - config, + config: config, githubChecksUtil: mockGithubChecksUtil, gerritService: FakeGerritService( branchesValue: ['master'], @@ -265,7 +265,7 @@ void main() { test('schedules cocoon based targets - multiple batch requests', () async { final MockBuildBucketClient mockBuildBucketClient = MockBuildBucketClient(); final FakeLuciBuildService luciBuildService = FakeLuciBuildService( - config, + config: config, buildbucket: mockBuildBucketClient, gerritService: FakeGerritService(), pubsub: pubsub, @@ -540,7 +540,7 @@ targets: githubChecksService: GithubChecksService(config, githubChecksUtil: mockGithubChecksUtil), httpClientProvider: () => httpClient, luciBuildService: FakeLuciBuildService( - config, + config: config, githubChecksUtil: mockGithubChecksUtil, gerritService: FakeGerritService(branchesValue: ['master']), ), @@ -664,7 +664,7 @@ targets: buildStatusProvider: (_) => buildStatusService, httpClientProvider: () => httpClient, luciBuildService: FakeLuciBuildService( - config, + config: config, githubChecksUtil: mockGithubChecksUtil, buildbucket: mockBuildbucket, gerritService: FakeGerritService(branchesValue: ['master']), diff --git a/app_dart/test/src/request_handling/api_request_handler_tester.dart b/app_dart/test/src/request_handling/api_request_handler_tester.dart index a8fb5981a..ed40fb074 100644 --- a/app_dart/test/src/request_handling/api_request_handler_tester.dart +++ b/app_dart/test/src/request_handling/api_request_handler_tester.dart @@ -10,17 +10,15 @@ import 'package:cocoon_service/src/request_handling/request_handler.dart'; import 'package:meta/meta.dart'; import 'fake_authentication.dart'; -import 'fake_http.dart'; import 'request_handler_tester.dart'; class ApiRequestHandlerTester extends RequestHandlerTester { ApiRequestHandlerTester({ - FakeHttpRequest? request, + super.request, FakeAuthenticatedContext? context, Map? requestData, }) : context = context ?? FakeAuthenticatedContext(), - requestData = requestData ?? {}, - super(request: request); + requestData = requestData ?? {}; FakeAuthenticatedContext context; Map requestData; diff --git a/app_dart/test/src/request_handling/fake_request_handler.dart b/app_dart/test/src/request_handling/fake_request_handler.dart index fe45bb2e8..4a4c19acf 100644 --- a/app_dart/test/src/request_handling/fake_request_handler.dart +++ b/app_dart/test/src/request_handling/fake_request_handler.dart @@ -4,14 +4,13 @@ import 'package:cocoon_service/src/request_handling/body.dart'; import 'package:cocoon_service/src/request_handling/request_handler.dart'; -import 'package:cocoon_service/src/service/config.dart'; // ignore: must_be_immutable class FakeRequestHandler extends RequestHandler { FakeRequestHandler({ required this.body, - required Config config, - }) : super(config: config); + required super.config, + }); final Body body; diff --git a/app_dart/test/src/request_handling/no_auth_request_handler_tester.dart b/app_dart/test/src/request_handling/no_auth_request_handler_tester.dart index 942a8a2ec..e161bea91 100644 --- a/app_dart/test/src/request_handling/no_auth_request_handler_tester.dart +++ b/app_dart/test/src/request_handling/no_auth_request_handler_tester.dart @@ -3,22 +3,19 @@ // found in the LICENSE file. import 'dart:async'; -import 'dart:io'; import 'package:cocoon_service/src/request_handling/body.dart'; import 'package:cocoon_service/src/request_handling/no_auth_request_handler.dart'; import 'package:cocoon_service/src/request_handling/request_handler.dart'; import 'package:meta/meta.dart'; -import 'fake_http.dart'; import 'request_handler_tester.dart'; class NoAuthRequestHandlerTester extends RequestHandlerTester { NoAuthRequestHandlerTester({ - HttpRequest? request, + super.request, Map? requestData, - }) : requestData = requestData ?? {}, - super(request: request as FakeHttpRequest?); + }) : requestData = requestData ?? {}; Map requestData; diff --git a/app_dart/test/src/request_handling/subscription_tester.dart b/app_dart/test/src/request_handling/subscription_tester.dart index dcfbf080b..eb6c3ab57 100644 --- a/app_dart/test/src/request_handling/subscription_tester.dart +++ b/app_dart/test/src/request_handling/subscription_tester.dart @@ -12,16 +12,14 @@ import 'package:cocoon_service/src/request_handling/subscription_handler.dart'; import 'package:meta/meta.dart'; import 'fake_authentication.dart'; -import 'fake_http.dart'; import 'request_handler_tester.dart'; class SubscriptionTester extends RequestHandlerTester { SubscriptionTester({ - FakeHttpRequest? request, + super.request, FakeAuthenticatedContext? context, this.message = const PushMessage(), - }) : context = context ?? FakeAuthenticatedContext(), - super(request: request); + }) : context = context ?? FakeAuthenticatedContext(); FakeAuthenticatedContext context; PushMessage message; diff --git a/app_dart/test/src/service/fake_luci_build_service.dart b/app_dart/test/src/service/fake_luci_build_service.dart index e91d2ef6a..2d79e512c 100644 --- a/app_dart/test/src/service/fake_luci_build_service.dart +++ b/app_dart/test/src/service/fake_luci_build_service.dart @@ -5,7 +5,6 @@ import 'package:cocoon_service/src/foundation/github_checks_util.dart'; import 'package:cocoon_service/src/request_handling/pubsub.dart'; import 'package:cocoon_service/src/service/buildbucket.dart'; -import 'package:cocoon_service/src/service/config.dart'; import 'package:cocoon_service/src/service/gerrit_service.dart'; import 'package:cocoon_service/src/service/luci_build_service.dart'; @@ -16,15 +15,14 @@ import 'fake_gerrit_service.dart'; /// Fake [LuciBuildService] for use in tests. class FakeLuciBuildService extends LuciBuildService { - FakeLuciBuildService( - Config config, { + FakeLuciBuildService({ + required super.config, BuildBucketClient? buildbucket, GithubChecksUtil? githubChecksUtil, GerritService? gerritService, PubSub? pubsub, }) : super( - config, - buildbucket ?? FakeBuildBucketClient(), + buildBucketClient: buildbucket ?? FakeBuildBucketClient(), githubChecksUtil: githubChecksUtil ?? MockGithubChecksUtil(), gerritService: gerritService ?? FakeGerritService(), pubsub: pubsub ?? FakePubSub(), diff --git a/app_dart/test/src/service/fake_scheduler.dart b/app_dart/test/src/service/fake_scheduler.dart index b8d47091e..96a2d37de 100644 --- a/app_dart/test/src/service/fake_scheduler.dart +++ b/app_dart/test/src/service/fake_scheduler.dart @@ -8,7 +8,6 @@ import 'package:cocoon_service/src/model/ci_yaml/ci_yaml.dart'; import 'package:cocoon_service/src/model/proto/protos.dart' as pb; import 'package:cocoon_service/src/service/buildbucket.dart'; import 'package:cocoon_service/src/service/cache_service.dart'; -import 'package:cocoon_service/src/service/config.dart'; import 'package:cocoon_service/src/service/github_checks_service.dart'; import 'package:cocoon_service/src/service/luci_build_service.dart'; import 'package:cocoon_service/src/service/scheduler.dart'; @@ -24,14 +23,20 @@ class FakeScheduler extends Scheduler { this.ciYaml, LuciBuildService? luciBuildService, BuildBucketClient? buildbucket, - required Config config, + required super.config, GithubChecksUtil? githubChecksUtil, }) : super( cache: CacheService(inMemory: true), - config: config, - githubChecksService: GithubChecksService(config, githubChecksUtil: githubChecksUtil), + githubChecksService: GithubChecksService( + config, + githubChecksUtil: githubChecksUtil, + ), luciBuildService: luciBuildService ?? - FakeLuciBuildService(config, buildbucket: buildbucket, githubChecksUtil: githubChecksUtil), + FakeLuciBuildService( + config: config, + buildbucket: buildbucket, + githubChecksUtil: githubChecksUtil, + ), ); final CiYaml _defaultConfig = emptyConfig;