diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-04-01 21:11:11 +0300 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-04-01 21:11:11 +0300 |
commit | 57cba4d1e9e9964359a5c55bca6558db0d511d98 (patch) | |
tree | 3ddab54d2f4379541657575f36a49f3f7820a65b /spec | |
parent | 90614929ba3f3d4ac03213673b612d9834900478 (diff) | |
parent | d4c6a3af78c0ef8257c453980832c4d419aabb51 (diff) |
Merge branch 'sh-force-gc-after-import' into 'master'
Force a full GC after importing a project
Closes #59477
See merge request gitlab-org/gitlab-ce!26803
Diffstat (limited to 'spec')
-rw-r--r-- | spec/services/projects/after_import_service_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/projects/housekeeping_service_spec.rb | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/spec/services/projects/after_import_service_spec.rb b/spec/services/projects/after_import_service_spec.rb index 4dd6c6dab86..765b4ffae8f 100644 --- a/spec/services/projects/after_import_service_spec.rb +++ b/spec/services/projects/after_import_service_spec.rb @@ -13,7 +13,7 @@ describe Projects::AfterImportService do describe '#execute' do before do allow(Projects::HousekeepingService) - .to receive(:new).with(project).and_return(housekeeping_service) + .to receive(:new).with(project, :gc).and_return(housekeeping_service) allow(housekeeping_service) .to receive(:execute).and_yield diff --git a/spec/services/projects/housekeeping_service_spec.rb b/spec/services/projects/housekeeping_service_spec.rb index 18ecef1c0a1..12ae9105627 100644 --- a/spec/services/projects/housekeeping_service_spec.rb +++ b/spec/services/projects/housekeeping_service_spec.rb @@ -88,6 +88,19 @@ describe Projects::HousekeepingService do expect(project.pushes_since_gc).to eq(1) end end + + it 'runs the task specifically requested' do + housekeeping = described_class.new(project, :gc) + + allow(housekeeping).to receive(:try_obtain_lease).and_return(:gc_uuid) + allow(housekeeping).to receive(:lease_key).and_return(:gc_lease_key) + + expect(GitGarbageCollectWorker).to receive(:perform_async).with(project.id, :gc, :gc_lease_key, :gc_uuid).twice + + 2.times do + housekeeping.execute + end + end end describe '#needed?' do |