Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeger-Jan van de Weg <git@zjvandeweg.nl>2018-12-17 11:49:38 +0300
committerZeger-Jan van de Weg <git@zjvandeweg.nl>2018-12-19 15:21:56 +0300
commit752e9c18a1c2521636ddeec65b7bda2035ce1893 (patch)
tree157a76334e9c54264dde1dda62eb85f1b17e5914 /spec/workers
parent73d4b1f625af4cb9e10c4e862ed63a54904f746f (diff)
Leave object pools when destroying projects
This action doesn't lean on reduplication, so a short call can me made to the Gitaly server to have the object pool remove its remote to the project pending deletion. https://gitlab.com/gitlab-org/gitaly/blob/f6cd55357/internal/git/objectpool/link.go#L58 When an object pool doesn't have members, this would invalidate the need for a pool. So when a project leaves the pool, the pool will be destroyed on the background. Fixes: https://gitlab.com/gitlab-org/gitaly/issues/1415
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/object_pool/destroy_worker_spec.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/workers/object_pool/destroy_worker_spec.rb b/spec/workers/object_pool/destroy_worker_spec.rb
new file mode 100644
index 00000000000..ef74f0ba87c
--- /dev/null
+++ b/spec/workers/object_pool/destroy_worker_spec.rb
@@ -0,0 +1,31 @@
+# frozen_string_literal: true
+
+describe ObjectPool::DestroyWorker 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)
+
+ 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