File: destroy_worker_spec.rb

package info (click to toggle)
gitlab 17.6.5-19
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 629,368 kB
  • sloc: ruby: 1,915,304; javascript: 557,307; sql: 60,639; xml: 6,509; sh: 4,567; makefile: 1,239; python: 406
file content (37 lines) | stat: -rw-r--r-- 955 bytes parent folder | download
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
31
32
33
34
35
36
37
# frozen_string_literal: true

RSpec.describe ObjectPool::DestroyWorker, feature_category: :shared do
  describe '#perform' do
    context 'when no pool is in the database' do
      it "doesn't raise an error" do
        expect do
          described_class.new.perform(987654321)
        end.not_to raise_error
      end
    end

    context 'when a pool is present' do
      let(:pool) { create(:pool_repository, :obsolete) }

      subject { described_class.new }

      it 'requests Gitaly to remove the object pool' do
        expect(Gitlab::GitalyClient).to receive(:call).with(
          pool.shard_name,
          :object_pool_service,
          :delete_object_pool,
          Object,
          timeout: Gitlab::GitalyClient.long_timeout
        )

        subject.perform(pool.id)
      end

      it 'destroys the pool' do
        subject.perform(pool.id)

        expect(PoolRepository.find_by_id(pool.id)).to be_nil
      end
    end
  end
end