2019-03-30 07:15:48 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-10-27 12:59:52 +00:00
|
|
|
require 'fileutils'
|
|
|
|
|
2016-07-08 19:32:58 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 15:08:50 +00:00
|
|
|
RSpec.describe GitGarbageCollectWorker do
|
2020-08-12 15:10:02 +00:00
|
|
|
let_it_be(:project) { create(:project, :repository) }
|
2020-07-31 12:10:02 +00:00
|
|
|
|
2021-01-21 12:09:05 +00:00
|
|
|
let(:lease_uuid) { SecureRandom.uuid }
|
|
|
|
let(:lease_key) { "project_housekeeping:#{project.id}" }
|
|
|
|
let(:task) { :full_repack }
|
|
|
|
let(:params) { [project.id, task, lease_key, lease_uuid] }
|
2020-09-17 09:09:32 +00:00
|
|
|
|
2021-01-21 12:09:05 +00:00
|
|
|
subject { described_class.new }
|
2020-07-31 12:10:02 +00:00
|
|
|
|
2016-07-08 19:32:58 +00:00
|
|
|
describe "#perform" do
|
2021-01-21 12:09:05 +00:00
|
|
|
it 'calls the Projects::GitGarbageGitGarbageCollectWorker with the same params' do
|
|
|
|
expect_next_instance_of(Projects::GitGarbageCollectWorker) do |instance|
|
|
|
|
expect(instance).to receive(:perform).with(*params)
|
2017-09-04 17:55:04 +00:00
|
|
|
end
|
|
|
|
|
2021-01-21 12:09:05 +00:00
|
|
|
subject.perform(*params)
|
2018-06-05 15:58:28 +00:00
|
|
|
end
|
2016-10-27 12:59:52 +00:00
|
|
|
end
|
2016-07-08 19:32:58 +00:00
|
|
|
end
|