diff options
Diffstat (limited to 'spec/workers/namespaces/schedule_aggregation_worker_spec.rb')
-rw-r--r-- | spec/workers/namespaces/schedule_aggregation_worker_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/workers/namespaces/schedule_aggregation_worker_spec.rb b/spec/workers/namespaces/schedule_aggregation_worker_spec.rb index a2ce9891b5f..e7da346df46 100644 --- a/spec/workers/namespaces/schedule_aggregation_worker_spec.rb +++ b/spec/workers/namespaces/schedule_aggregation_worker_spec.rb @@ -54,6 +54,17 @@ describe Namespaces::ScheduleAggregationWorker, '#perform', :clean_gitlab_redis_ end end + it_behaves_like 'an idempotent worker' do + let(:job_args) { [group.id] } + + it 'creates a single aggregation schedule' do + expect { worker.perform(*job_args) } + .to change { Namespace::AggregationSchedule.count }.by(1) + expect { worker.perform(*job_args) } + .not_to change { Namespace::AggregationSchedule.count } + end + end + def stub_aggregation_schedule_statistics # Namespace::Aggregations are deleted by # Namespace::AggregationSchedule::schedule_root_storage_statistics, |