diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-02-06 19:54:34 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-02-06 19:54:34 +0000 |
commit | ee43dcd5d633f19b13a1d914a403686faec2bbca (patch) | |
tree | 082349114144dd1c3faa52bed58081da593411ca /spec/services/projects | |
parent | 5ae946f21ce3ddb513d367fb63f6a1cd44006e2a (diff) | |
parent | ad59f123f24617834ec705b39e96dd4ff5f8d3bf (diff) | |
download | gitlab-ce-ee43dcd5d633f19b13a1d914a403686faec2bbca.tar.gz |
Merge branch 'fix-deleting-project-again' into 'master'
Skip or retain project while deleting the project:
Closes #15005
See merge request !8960
Diffstat (limited to 'spec/services/projects')
-rw-r--r-- | spec/services/projects/destroy_service_spec.rb | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/spec/services/projects/destroy_service_spec.rb b/spec/services/projects/destroy_service_spec.rb index 90771825f5c..3faa88c00a1 100644 --- a/spec/services/projects/destroy_service_spec.rb +++ b/spec/services/projects/destroy_service_spec.rb @@ -9,12 +9,27 @@ describe Projects::DestroyService, services: true do shared_examples 'deleting the project' do it 'deletes the project' do - expect(Project.all).not_to include(project) + expect(Project.unscoped.all).not_to include(project) expect(Dir.exist?(path)).to be_falsey expect(Dir.exist?(remove_path)).to be_falsey end end + shared_examples 'deleting the project with pipeline and build' do + context 'with pipeline and build' do # which has optimistic locking + let!(:pipeline) { create(:ci_pipeline, project: project) } + let!(:build) { create(:ci_build, :artifacts, pipeline: pipeline) } + + before do + perform_enqueued_jobs do + destroy_project(project, user, {}) + end + end + + it_behaves_like 'deleting the project' + end + end + context 'Sidekiq inline' do before do # Run sidekiq immediatly to check that renamed repository will be removed @@ -35,30 +50,24 @@ describe Projects::DestroyService, services: true do it { expect(Dir.exist?(remove_path)).to be_truthy } end - context 'async delete of project with private issue visibility' do - let!(:async) { true } + context 'with async_execute' do + let(:async) { true } - before do - project.project_feature.update_attribute("issues_access_level", ProjectFeature::PRIVATE) - # Run sidekiq immediately to check that renamed repository will be removed - Sidekiq::Testing.inline! { destroy_project(project, user, {}) } + context 'async delete of project with private issue visibility' do + before do + project.project_feature.update_attribute("issues_access_level", ProjectFeature::PRIVATE) + # Run sidekiq immediately to check that renamed repository will be removed + Sidekiq::Testing.inline! { destroy_project(project, user, {}) } + end + + it_behaves_like 'deleting the project' end - it_behaves_like 'deleting the project' + it_behaves_like 'deleting the project with pipeline and build' end - context 'delete with pipeline' do # which has optimistic locking - let!(:pipeline) { create(:ci_pipeline, project: project) } - - before do - expect(project).to receive(:destroy!).and_call_original - - perform_enqueued_jobs do - destroy_project(project, user, {}) - end - end - - it_behaves_like 'deleting the project' + context 'with execute' do + it_behaves_like 'deleting the project with pipeline and build' end context 'container registry' do |