@@ -7,6 +7,7 @@ import 'dart:io';
77
88import 'package:gcloud/service_scope.dart' as ss;
99import 'package:logging/logging.dart' ;
10+ import 'package:meta/meta.dart' ;
1011import 'package:neat_periodic_task/neat_periodic_task.dart' ;
1112import 'package:pub_dev/service/download_counts/computations.dart' ;
1213
@@ -43,7 +44,9 @@ void setupPeriodTaskSchedulers() {
4344}
4445
4546/// List of periodic task schedulers.
46- List <NeatPeriodicTaskScheduler > createPeriodicTaskSchedulers () {
47+ List <NeatPeriodicTaskScheduler > createPeriodicTaskSchedulers ({
48+ @visibleForTesting bool isPostTestVerification = false ,
49+ }) {
4750 return [
4851 // Tries to send pending outgoing emails.
4952 _15mins (
@@ -203,11 +206,15 @@ List<NeatPeriodicTaskScheduler> createPeriodicTaskSchedulers() {
203206 task: countTopics,
204207 ),
205208
206- _daily (
207- name: 'sync-security-advisories' ,
208- isRuntimeVersioned: false ,
209- task: syncSecurityAdvisories,
210- ),
209+ // NOTE: This task will fetch the advisories from a public endpoint,
210+ // running it on every test is not worth it.
211+ // TODO: Consider injecting a fake data source for unit test.
212+ if (! isPostTestVerification)
213+ _daily (
214+ name: 'sync-security-advisories' ,
215+ isRuntimeVersioned: false ,
216+ task: syncSecurityAdvisories,
217+ ),
211218
212219 // Checks the Datastore integrity of the model objects.
213220 _weekly (
0 commit comments