Commit de29affc authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch '326209-remove-unnecessary-validation' into 'master'

Remove unnecessary validation avoiding N+1 queries when building integrations

See merge request gitlab-org/gitlab!59635
parents 19f27e47 be4a1dac
...@@ -241,7 +241,6 @@ class Service < ApplicationRecord ...@@ -241,7 +241,6 @@ class Service < ApplicationRecord
service.project_id = project_id service.project_id = project_id
service.group_id = group_id service.group_id = group_id
service.inherit_from_id = integration.id if integration.instance? || integration.group service.inherit_from_id = integration.id if integration.instance? || integration.group
service.active = false if service.invalid?
service service
end end
......
---
title: Remove unnecessary validation avoiding N+1 queries when building integrations
merge_request: 59635
author:
type: performance
...@@ -273,16 +273,6 @@ RSpec.describe Projects::CreateService, '#execute' do ...@@ -273,16 +273,6 @@ RSpec.describe Projects::CreateService, '#execute' do
opts[:default_branch] = 'master' opts[:default_branch] = 'master'
expect(create_project(user, opts)).to eq(nil) expect(create_project(user, opts)).to eq(nil)
end end
it 'sets invalid service as inactive' do
create(:service, type: 'JiraService', project: nil, template: true, active: true)
project = create_project(user, opts)
service = project.services.first
expect(project).to be_persisted
expect(service.active).to be false
end
end end
context 'wiki_enabled creates repository directory' do context 'wiki_enabled creates repository directory' do
...@@ -633,17 +623,6 @@ RSpec.describe Projects::CreateService, '#execute' do ...@@ -633,17 +623,6 @@ RSpec.describe Projects::CreateService, '#execute' do
end end
end end
end end
context 'when there is an invalid integration' do
before do
create(:service, :template, type: 'DroneCiService', active: true)
end
it 'creates an inactive service' do
expect(project).to be_persisted
expect(project.services.first.active).to be false
end
end
end end
context 'when skip_disk_validation is used' do context 'when skip_disk_validation is used' do
......
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