summaryrefslogtreecommitdiff
path: root/spec/workers
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2019-01-23 03:40:05 +0100
committerGabriel Mazetto <brodock@gmail.com>2019-03-01 15:49:20 +0100
commitfc0ff92807620c36d01f23eb0d7d88b02cb141c1 (patch)
tree8241564fc370782be698266bb14d5c1a69a1ded0 /spec/workers
parentd63380fa93dff921c69f7aaa31ff004864e4db13 (diff)
downloadgitlab-ce-fc0ff92807620c36d01f23eb0d7d88b02cb141c1.tar.gz
Added Rollbacker workers and support on the rake task
Rollback is done similar to Migration for the Hashed Storage. It also shares the same ExclusiveLease key to prevent both happening at the same time. All Hashed Storage related workers now share the same queue namespace which allows for assigning dedicated workers easily.
Diffstat (limited to 'spec/workers')
-rw-r--r--spec/workers/hashed_storage/rollbacker_worker_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/workers/hashed_storage/rollbacker_worker_spec.rb b/spec/workers/hashed_storage/rollbacker_worker_spec.rb
new file mode 100644
index 00000000000..4055f380978
--- /dev/null
+++ b/spec/workers/hashed_storage/rollbacker_worker_spec.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe HashedStorage::RollbackerWorker do
+ subject(:worker) { described_class.new }
+ let(:projects) { create_list(:project, 2, :empty_repo) }
+ let(:ids) { projects.map(&:id) }
+
+ describe '#perform' do
+ it 'delegates to MigratorService' do
+ expect_any_instance_of(Gitlab::HashedStorage::Migrator).to receive(:bulk_rollback).with(start: 5, finish: 10)
+
+ worker.perform(5, 10)
+ end
+
+ it 'rollsback projects in the specified range' do
+ perform_enqueued_jobs do
+ worker.perform(ids.min, ids.max)
+ end
+
+ projects.each do |project|
+ expect(project.reload.legacy_storage?).to be_truthy
+ end
+ end
+ end
+end