Commit 55be2245 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch...

Merge branch '330882-dependency-scanning-vulnerability-reports-a-lot-of-duplicate-links-2' into 'master'

Disable finding link creation

See merge request gitlab-org/gitlab!68381
parents 3d6987ff 144d35eb
...@@ -48,7 +48,7 @@ module Security ...@@ -48,7 +48,7 @@ module Security
create_vulnerability_finding(vulnerability_findings_by_uuid, finding)&.id create_vulnerability_finding(vulnerability_findings_by_uuid, finding)&.id
end.compact.uniq end.compact.uniq
update_vulnerability_links_info update_vulnerability_links_info if Feature.enabled?(:vulnerability_finding_replace_metadata)
create_vulnerability_pipeline_objects create_vulnerability_pipeline_objects
update_vulnerabilities_identifiers update_vulnerabilities_identifiers
update_vulnerabilities_finding_identifiers update_vulnerabilities_finding_identifiers
......
...@@ -67,6 +67,16 @@ RSpec.describe Security::StoreReportService, '#execute' do ...@@ -67,6 +67,16 @@ RSpec.describe Security::StoreReportService, '#execute' do
expect { subject }.to change { Vulnerabilities::FindingLink.count }.by(finding_links) expect { subject }.to change { Vulnerabilities::FindingLink.count }.by(finding_links)
end end
context 'when finding links creation is disabled' do
before do
stub_feature_flags(vulnerability_finding_replace_metadata: false)
end
it 'does not insert finding links' do
expect { subject }.not_to change { Vulnerabilities::FindingLink.count }
end
end
it 'inserts all finding identifiers (join model)' do it 'inserts all finding identifiers (join model)' do
expect { subject }.to change { Vulnerabilities::FindingIdentifier.count }.by(finding_identifiers) expect { subject }.to change { Vulnerabilities::FindingIdentifier.count }.by(finding_identifiers)
end end
...@@ -550,7 +560,7 @@ RSpec.describe Security::StoreReportService, '#execute' do ...@@ -550,7 +560,7 @@ RSpec.describe Security::StoreReportService, '#execute' do
let!(:issue_link) { create(:vulnerabilities_issue_link, issue: issue, vulnerability_id: vulnerability.id) } let!(:issue_link) { create(:vulnerabilities_issue_link, issue: issue, vulnerability_id: vulnerability.id) }
it 'will not raise an error' do it 'will not raise an error' do
expect { subject }.not_to raise_error(ActiveRecord::RecordInvalid) expect { subject }.not_to raise_error
end end
it 'does not insert issue link from the new pipeline' do it 'does not insert issue link from the new pipeline' 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