From fc0ff92807620c36d01f23eb0d7d88b02cb141c1 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Wed, 23 Jan 2019 03:40:05 +0100 Subject: 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. --- .../hashed_storage/rollbacker_worker_spec.rb | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 spec/workers/hashed_storage/rollbacker_worker_spec.rb (limited to 'spec/workers') 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 -- cgit v1.2.3