Skip to content

Commit 4c0668a

Browse files
committed
Remove advisory sync task from post-test verifications.
1 parent edfb133 commit 4c0668a

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

app/lib/tool/neat_task/pub_dev_tasks.dart

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'dart:io';
77

88
import 'package:gcloud/service_scope.dart' as ss;
99
import 'package:logging/logging.dart';
10+
import 'package:meta/meta.dart';
1011
import 'package:neat_periodic_task/neat_periodic_task.dart';
1112
import '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(

app/test/shared/test_services.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ Future<void> _postTestVerification({
142142
}
143143

144144
// run all background tasks here
145-
for (final scheduler in createPeriodicTaskSchedulers()) {
145+
final schedulers = createPeriodicTaskSchedulers(isPostTestVerification: true);
146+
for (final scheduler in schedulers) {
146147
await scheduler.trigger();
147148
}
148149

0 commit comments

Comments
 (0)