diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb index 785057dd125..48578b6d9e5 100644 --- a/app/services/projects/create_service.rb +++ b/app/services/projects/create_service.rb @@ -115,7 +115,7 @@ module Projects Project.transaction do @project.create_or_update_import_data(data: import_data[:data], credentials: import_data[:credentials]) if import_data - if @project.valid? && @project.save && !@project.import? + if @project.save && !@project.import? raise 'Failed to create repository' unless @project.create_repository end end diff --git a/spec/javascripts/fixtures/blob.rb b/spec/javascripts/fixtures/blob.rb index 2dffc42b0ef..81e8a51a902 100644 --- a/spec/javascripts/fixtures/blob.rb +++ b/spec/javascripts/fixtures/blob.rb @@ -17,6 +17,10 @@ describe Projects::BlobController, '(JavaScript fixtures)', type: :controller do sign_in(admin) end + after do + remove_repository(project) + end + it 'blob/show.html.raw' do |example| get(:show, namespace_id: project.namespace, diff --git a/spec/javascripts/fixtures/branches.rb b/spec/javascripts/fixtures/branches.rb index bb3bdf7c215..4fc072d2585 100644 --- a/spec/javascripts/fixtures/branches.rb +++ b/spec/javascripts/fixtures/branches.rb @@ -17,6 +17,10 @@ describe Projects::BranchesController, '(JavaScript fixtures)', type: :controlle sign_in(admin) end + after do + remove_repository(project) + end + it 'branches/new_branch.html.raw' do |example| get :new, namespace_id: project.namespace.to_param, diff --git a/spec/javascripts/fixtures/dashboard.rb b/spec/javascripts/fixtures/dashboard.rb index 793ffa7c220..7fa351680c9 100644 --- a/spec/javascripts/fixtures/dashboard.rb +++ b/spec/javascripts/fixtures/dashboard.rb @@ -17,6 +17,10 @@ describe Dashboard::ProjectsController, '(JavaScript fixtures)', type: :controll sign_in(admin) end + after do + remove_repository(project) + end + it 'dashboard/user-callout.html.raw' do |example| rendered = render_template('shared/_user_callout') store_frontend_fixture(rendered, example.description) diff --git a/spec/javascripts/fixtures/deploy_keys.rb b/spec/javascripts/fixtures/deploy_keys.rb index bea161c514f..580894ceaf9 100644 --- a/spec/javascripts/fixtures/deploy_keys.rb +++ b/spec/javascripts/fixtures/deploy_keys.rb @@ -16,6 +16,10 @@ describe Projects::DeployKeysController, '(JavaScript fixtures)', type: :control sign_in(admin) end + after do + remove_repository(project) + end + render_views it 'deploy_keys/keys.json' do |example| diff --git a/spec/javascripts/fixtures/issues.rb b/spec/javascripts/fixtures/issues.rb index d3ad50af1b9..0ee2f82dfd6 100644 --- a/spec/javascripts/fixtures/issues.rb +++ b/spec/javascripts/fixtures/issues.rb @@ -17,6 +17,10 @@ describe Projects::IssuesController, '(JavaScript fixtures)', type: :controller sign_in(admin) end + after do + remove_repository(project) + end + it 'issues/open-issue.html.raw' do |example| render_issue(example.description, create(:issue, project: project)) end diff --git a/spec/javascripts/fixtures/jobs.rb b/spec/javascripts/fixtures/jobs.rb index 83a96797506..87d131dfe28 100644 --- a/spec/javascripts/fixtures/jobs.rb +++ b/spec/javascripts/fixtures/jobs.rb @@ -21,6 +21,10 @@ describe Projects::JobsController, '(JavaScript fixtures)', type: :controller do sign_in(admin) end + after do + remove_repository(project) + end + it 'builds/build-with-artifacts.html.raw' do |example| get :show, namespace_id: project.namespace.to_param, diff --git a/spec/javascripts/fixtures/labels.rb b/spec/javascripts/fixtures/labels.rb index 814f065f3a4..b730d557e21 100644 --- a/spec/javascripts/fixtures/labels.rb +++ b/spec/javascripts/fixtures/labels.rb @@ -19,6 +19,10 @@ describe 'Labels (JavaScript fixtures)' do clean_frontend_fixtures('labels/') end + after do + remove_repository(project) + end + describe Groups::LabelsController, '(JavaScript fixtures)', type: :controller do render_views diff --git a/spec/javascripts/fixtures/merge_requests.rb b/spec/javascripts/fixtures/merge_requests.rb index f97a5d2b5de..767db7e1868 100644 --- a/spec/javascripts/fixtures/merge_requests.rb +++ b/spec/javascripts/fixtures/merge_requests.rb @@ -37,6 +37,10 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont sign_in(admin) end + after do + remove_repository(project) + end + it 'merge_requests/merge_request_with_task_list.html.raw' do |example| create(:ci_build, :pending, pipeline: pipeline) diff --git a/spec/javascripts/fixtures/merge_requests_diffs.rb b/spec/javascripts/fixtures/merge_requests_diffs.rb index 6e0a97d2e3f..ddce00bc0fe 100644 --- a/spec/javascripts/fixtures/merge_requests_diffs.rb +++ b/spec/javascripts/fixtures/merge_requests_diffs.rb @@ -29,6 +29,10 @@ describe Projects::MergeRequests::DiffsController, '(JavaScript fixtures)', type sign_in(admin) end + after do + remove_repository(project) + end + it 'merge_request_diffs/inline_changes_tab_with_comments.json' do |example| create(:diff_note_on_merge_request, project: project, author: admin, position: position, noteable: merge_request) create(:note_on_merge_request, author: admin, project: project, noteable: merge_request) diff --git a/spec/javascripts/fixtures/projects.rb b/spec/javascripts/fixtures/projects.rb index f09d44a49d1..2a100e7fab5 100644 --- a/spec/javascripts/fixtures/projects.rb +++ b/spec/javascripts/fixtures/projects.rb @@ -17,6 +17,10 @@ describe ProjectsController, '(JavaScript fixtures)', type: :controller do sign_in(admin) end + after do + remove_repository(project) + end + it 'projects/dashboard.html.raw' do |example| get :show, namespace_id: project.namespace.to_param, diff --git a/spec/javascripts/fixtures/prometheus_service.rb b/spec/javascripts/fixtures/prometheus_service.rb index 7968c9425f2..f95f8038ffb 100644 --- a/spec/javascripts/fixtures/prometheus_service.rb +++ b/spec/javascripts/fixtures/prometheus_service.rb @@ -18,6 +18,10 @@ describe Projects::ServicesController, '(JavaScript fixtures)', type: :controlle sign_in(admin) end + after do + remove_repository(project) + end + it 'services/prometheus/prometheus_service.html.raw' do |example| get :edit, namespace_id: namespace, diff --git a/spec/javascripts/fixtures/raw.rb b/spec/javascripts/fixtures/raw.rb index 25f5a3b0bb3..82770beb39b 100644 --- a/spec/javascripts/fixtures/raw.rb +++ b/spec/javascripts/fixtures/raw.rb @@ -10,6 +10,10 @@ describe 'Raw files', '(JavaScript fixtures)', type: :controller do clean_frontend_fixtures('blob/notebook/') end + after do + remove_repository(project) + end + it 'blob/notebook/basic.json' do |example| blob = project.repository.blob_at('6d85bb69', 'files/ipython/basic.ipynb') diff --git a/spec/javascripts/fixtures/services.rb b/spec/javascripts/fixtures/services.rb index 80915c32a74..9280ed5a7f1 100644 --- a/spec/javascripts/fixtures/services.rb +++ b/spec/javascripts/fixtures/services.rb @@ -18,6 +18,10 @@ describe Projects::ServicesController, '(JavaScript fixtures)', type: :controlle sign_in(admin) end + after do + remove_repository(project) + end + it 'services/edit_service.html.raw' do |example| get :edit, namespace_id: namespace, diff --git a/spec/javascripts/fixtures/snippet.rb b/spec/javascripts/fixtures/snippet.rb index 01bfb87b0c1..fa97f352e31 100644 --- a/spec/javascripts/fixtures/snippet.rb +++ b/spec/javascripts/fixtures/snippet.rb @@ -18,6 +18,10 @@ describe SnippetsController, '(JavaScript fixtures)', type: :controller do sign_in(admin) end + after do + remove_repository(project) + end + it 'snippets/show.html.raw' do |example| get(:show, id: snippet.to_param) diff --git a/spec/javascripts/fixtures/todos.rb b/spec/javascripts/fixtures/todos.rb index ba630365c18..426b854fe8b 100644 --- a/spec/javascripts/fixtures/todos.rb +++ b/spec/javascripts/fixtures/todos.rb @@ -15,6 +15,10 @@ describe 'Todos (JavaScript fixtures)' do clean_frontend_fixtures('todos/') end + after do + remove_repository(project) + end + describe Dashboard::TodosController, '(JavaScript fixtures)', type: :controller do render_views diff --git a/spec/support/javascript_fixtures_helpers.rb b/spec/support/javascript_fixtures_helpers.rb index aace4b3adee..923c8080e6c 100644 --- a/spec/support/javascript_fixtures_helpers.rb +++ b/spec/support/javascript_fixtures_helpers.rb @@ -31,6 +31,10 @@ module JavaScriptFixturesHelpers File.write(fixture_file_name, fixture) end + def remove_repository(project) + Gitlab::Shell.new.remove_repository(project.repository_storage_path, project.disk_path) + end + private # Private: Prepare a response object for use as a frontend fixture