Commit a07c013e authored by Stan Hu's avatar Stan Hu

Revert changes until gitlab-org/gitlab-ce!12435 is merged

parent 15c3bd99
module Groups
class DestroyService < Groups::BaseService
def async_execute
# Don't call `group.destroy` since this will purge all the projects, which may be too slow
group.deleted_at = Time.now
# Soft delete via paranoia gem
group.destroy
job_id = GroupDestroyWorker.perform_async(group.id, current_user.id)
Rails.logger.info("User #{current_user.id} scheduled a deletion of group ID #{group.id} with job ID #{job_id}")
end
......
require 'spec_helper'
describe Groups::DestroyService, services: true do
let!(:user) { create(:user) }
let!(:group) { create(:group) }
let!(:project) { create(:empty_project, namespace: group) }
let!(:geo_node) { create(:geo_node, :current, :primary) }
before do
group.add_user(user, Gitlab::Access::OWNER)
end
it 'creates a Geo event log when project is deleted synchronously' do
Groups::DestroyService.new(group, user).execute
expect(Geo::EventLog.count).to eq(1)
expect(Geo::RepositoryDeletedEvent.count).to eq(1)
end
it 'creates a Geo event log when project is deleted asynchronously' do
Sidekiq::Testing.inline! { Groups::DestroyService.new(group, user).async_execute }
expect(Geo::EventLog.count).to eq(1)
expect(Geo::RepositoryDeletedEvent.count).to eq(1)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment