Welcome to mirror list, hosted at ThFree Co, Russian Federation.

schedule_bulk_repository_shard_moves_shared_examples.rb « workers « shared_examples « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6707f65eb6931174ba9e332f60cb20dc35eaa328 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

RSpec.shared_examples 'schedules bulk repository shard moves' do
  let(:source_storage_name) { 'default' }
  let(:destination_storage_name) { 'test_second_storage' }

  describe "#perform" do
    before do
      stub_storage_settings(destination_storage_name => { 'path' => 'tmp/tests/extra_storage' })

      allow(worker_klass).to receive(:perform_async)
    end

    include_examples 'an idempotent worker' do
      let(:job_args) { [source_storage_name, destination_storage_name] }

      it 'schedules container repository storage moves' do
        expect { subject }.to change { move_service_klass.count }.by(1)

        storage_move = container.repository_storage_moves.last!

        expect(storage_move).to have_attributes(
          source_storage_name: source_storage_name,
          destination_storage_name: destination_storage_name,
          state_name: :scheduled
        )
      end
    end
  end
end