2020-07-28 23:09:34 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "spec_helper"
|
|
|
|
|
|
|
|
RSpec.describe PartitionCreationWorker do
|
|
|
|
describe '#perform' do
|
2020-11-24 15:15:51 +05:30
|
|
|
subject { described_class.new.perform }
|
|
|
|
|
|
|
|
let(:creator) { instance_double('PartitionCreator', create_partitions: nil) }
|
|
|
|
let(:monitoring) { instance_double('PartitionMonitoring', report_metrics: nil) }
|
2020-07-28 23:09:34 +05:30
|
|
|
|
|
|
|
before do
|
|
|
|
allow(Gitlab::Database::Partitioning::PartitionCreator).to receive(:new).and_return(creator)
|
2020-11-24 15:15:51 +05:30
|
|
|
allow(Gitlab::Database::Partitioning::PartitionMonitoring).to receive(:new).and_return(monitoring)
|
2020-07-28 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
it 'delegates to PartitionCreator' do
|
|
|
|
expect(creator).to receive(:create_partitions)
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
subject
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'reports partition metrics' do
|
|
|
|
expect(monitoring).to receive(:report_metrics)
|
|
|
|
|
|
|
|
subject
|
2020-07-28 23:09:34 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|