diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-01-08 13:02:58 +0100 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2019-01-14 16:09:47 +0100 |
commit | e03602e09de5d72b3bc5aee0df2a42807456a391 (patch) | |
tree | 1cd167e4e306ac4e1030676eea1db33bd7fad741 /spec/workers | |
parent | 94d05e3c5ce59448d63ee96e3474b0cd3ef2c995 (diff) | |
download | gitlab-ce-e03602e09de5d72b3bc5aee0df2a42807456a391.tar.gz |
Ensure pool participants are linked before GC
In theory the case could happen that the initial linking of the pool
fails and so do all the retries that Sidekiq performs. This could lead
to data loss.
To prevent that case, linking is done before Gits GC too. This makes
sure that case doesn't happen.
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/git_garbage_collect_worker_spec.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/workers/git_garbage_collect_worker_spec.rb b/spec/workers/git_garbage_collect_worker_spec.rb index a159f24f876..4895a968d6e 100644 --- a/spec/workers/git_garbage_collect_worker_spec.rb +++ b/spec/workers/git_garbage_collect_worker_spec.rb @@ -71,6 +71,17 @@ describe GitGarbageCollectWorker do subject.perform(project.id) end + + context 'when the repository has joined a pool' do + let!(:pool) { create(:pool_repository, :ready) } + let(:project) { pool.source_project } + + it 'ensures the repositories are linked' do + expect_any_instance_of(PoolRepository).to receive(:link_repository).once + + subject.perform(project.id) + end + end end context 'when no lease can be obtained' do |