Commit 327e2e13 authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'release-tools/update-gitaly' into 'master'

Update Gitaly version

See merge request gitlab-org/gitlab!83953
parents 66fb40e3 91a01489
cc42cf8f28dc37bf808dabaac8a055a84b83a5db
8b95897d918a4fefdc0542a72121182cd1f27f8f
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment