diff options
Diffstat (limited to 'spec/support/shared_examples/workers/concerns/git_garbage_collect_methods_shared_examples.rb')
-rw-r--r-- | spec/support/shared_examples/workers/concerns/git_garbage_collect_methods_shared_examples.rb | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/spec/support/shared_examples/workers/concerns/git_garbage_collect_methods_shared_examples.rb b/spec/support/shared_examples/workers/concerns/git_garbage_collect_methods_shared_examples.rb index 202606c6aa6..4751d91efde 100644 --- a/spec/support/shared_examples/workers/concerns/git_garbage_collect_methods_shared_examples.rb +++ b/spec/support/shared_examples/workers/concerns/git_garbage_collect_methods_shared_examples.rb @@ -230,76 +230,6 @@ RSpec.shared_examples 'can collect git garbage' do |update_statistics: true| stub_feature_flags(optimized_housekeeping: false) end - it 'incremental repack adds a new packfile' do - create_objects(resource) - before_packs = packs(resource) - - expect(before_packs.count).to be >= 1 - - subject.perform(resource.id, 'incremental_repack', lease_key, lease_uuid) - after_packs = packs(resource) - - # Exactly one new pack should have been created - expect(after_packs.count).to eq(before_packs.count + 1) - - # Previously existing packs are still around - expect(before_packs & after_packs).to eq(before_packs) - end - - it 'full repack consolidates into 1 packfile' do - create_objects(resource) - subject.perform(resource.id, 'incremental_repack', lease_key, lease_uuid) - before_packs = packs(resource) - - expect(before_packs.count).to be >= 2 - - subject.perform(resource.id, 'full_repack', lease_key, lease_uuid) - after_packs = packs(resource) - - expect(after_packs.count).to eq(1) - - # Previously existing packs should be gone now - expect(after_packs - before_packs).to eq(after_packs) - - expect(File.exist?(bitmap_path(after_packs.first))).to eq(bitmaps_enabled) - end - - it 'gc consolidates into 1 packfile and updates packed-refs' do - create_objects(resource) - before_packs = packs(resource) - before_packed_refs = packed_refs(resource) - - expect(before_packs.count).to be >= 1 - - # It's quite difficult to use `expect_next_instance_of` in this place - # because the RepositoryService is instantiated several times to do - # some repository calls like `exists?`, `create_repository`, ... . - # Therefore, since we're instantiating the object several times, - # RSpec has troubles figuring out which instance is the next and which - # one we want to mock. - # Besides, at this point, we actually want to perform the call to Gitaly, - # otherwise we would just use `instance_double` like in other parts of the - # spec file. - expect_any_instance_of(Gitlab::GitalyClient::RepositoryService) # rubocop:disable RSpec/AnyInstanceOf - .to receive(:garbage_collect) - .with(bitmaps_enabled, prune: false) - .and_call_original - - subject.perform(resource.id, 'gc', lease_key, lease_uuid) - after_packed_refs = packed_refs(resource) - after_packs = packs(resource) - - expect(after_packs.count).to eq(1) - - # Previously existing packs should be gone now - expect(after_packs - before_packs).to eq(after_packs) - - # The packed-refs file should have been updated during 'git gc' - expect(before_packed_refs).not_to eq(after_packed_refs) - - expect(File.exist?(bitmap_path(after_packs.first))).to eq(bitmaps_enabled) - end - it 'cleans up repository after finishing' do expect(resource).to receive(:cleanup).and_call_original |