diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-15 23:53:27 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-15 23:53:27 +0300 |
commit | 601cd5b4c0395abadeda5cfaf3b269b12662f743 (patch) | |
tree | e2e4a53982150ffca0baa7f8f749f1689acc1b71 /spec/models/pool_repository_spec.rb | |
parent | 7fc80ce5a5d21d2ba452eefabb02a2c8f7eb86ea (diff) |
Add latest changes from gitlab-org/gitlab@15-0-stable-ee
Diffstat (limited to 'spec/models/pool_repository_spec.rb')
-rw-r--r-- | spec/models/pool_repository_spec.rb | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/spec/models/pool_repository_spec.rb b/spec/models/pool_repository_spec.rb index 92b3e41cd18..447b7b2e0a2 100644 --- a/spec/models/pool_repository_spec.rb +++ b/spec/models/pool_repository_spec.rb @@ -24,23 +24,35 @@ RSpec.describe PoolRepository do end end - describe '#mark_obsolete_if_last' do + describe '#unlink_repository' do let(:pool) { create(:pool_repository, :ready) } + let(:repository_path) { File.join(TestEnv.repos_path, pool.source_project.repository.relative_path) } + let(:alternates_file) { File.join(repository_path, 'objects', 'info', 'alternates') } + + before do + pool.link_repository(pool.source_project.repository) + end context 'when the last member leaves' do it 'schedules pool removal' do expect(::ObjectPool::DestroyWorker).to receive(:perform_async).with(pool.id).and_call_original - pool.mark_obsolete_if_last(pool.source_project.repository) + pool.unlink_repository(pool.source_project.repository) + + expect(File).not_to exist(alternates_file) end end context 'when the second member leaves' do it 'does not schedule pool removal' do - create(:project, :repository, pool_repository: pool) + other_project = create(:project, :repository, pool_repository: pool) + pool.link_repository(other_project.repository) + expect(::ObjectPool::DestroyWorker).not_to receive(:perform_async).with(pool.id) - pool.mark_obsolete_if_last(pool.source_project.repository) + pool.unlink_repository(pool.source_project.repository) + + expect(File).not_to exist(alternates_file) end end end |