summaryrefslogtreecommitdiff
path: root/spec/models/project_statistics_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/project_statistics_spec.rb')
-rw-r--r--spec/models/project_statistics_spec.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/models/project_statistics_spec.rb b/spec/models/project_statistics_spec.rb
index 95da9a7521b..a6e2bcf1525 100644
--- a/spec/models/project_statistics_spec.rb
+++ b/spec/models/project_statistics_spec.rb
@@ -467,6 +467,13 @@ RSpec.describe ProjectStatistics do
.to change { statistics.reload.storage_size }
.by(20)
end
+
+ it 'schedules a namespace aggregation worker' do
+ expect(Namespaces::ScheduleAggregationWorker).to receive(:perform_async)
+ .with(statistics.project.namespace.id)
+
+ described_class.increment_statistic(project, stat, 20)
+ end
end
shared_examples 'a statistic that increases storage_size asynchronously' do
@@ -474,7 +481,8 @@ RSpec.describe ProjectStatistics do
described_class.increment_statistic(project, stat, 13)
Gitlab::Redis::SharedState.with do |redis|
- increment = redis.get(statistics.counter_key(stat))
+ key = statistics.counter(stat).key
+ increment = redis.get(key)
expect(increment.to_i).to eq(13)
end
end
@@ -482,7 +490,7 @@ RSpec.describe ProjectStatistics do
it 'schedules a worker to update the statistic and storage_size async', :sidekiq_inline do
expect(FlushCounterIncrementsWorker)
.to receive(:perform_in)
- .with(CounterAttribute::WORKER_DELAY, described_class.name, statistics.id, stat)
+ .with(Gitlab::Counters::BufferedCounter::WORKER_DELAY, described_class.name, statistics.id, stat)
.and_call_original
expect { described_class.increment_statistic(project, stat, 20) }