diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-25 09:06:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-09-25 09:06:16 +0300 |
commit | fbcb36880cda3a29cfa4ebed4d080701c302256b (patch) | |
tree | 7ef2430b3234f3ee30c45f7f9d05bf0e83aa5d19 /spec/lib/gitlab/background_migration | |
parent | 7bb7a8d529fd1155a35a2e9e9cdddd7953f3776d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/gitlab/background_migration')
-rw-r--r-- | spec/lib/gitlab/background_migration/update_vulnerability_confidence_spec.rb | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/spec/lib/gitlab/background_migration/update_vulnerability_confidence_spec.rb b/spec/lib/gitlab/background_migration/update_vulnerability_confidence_spec.rb deleted file mode 100644 index 1217edfecc3..00000000000 --- a/spec/lib/gitlab/background_migration/update_vulnerability_confidence_spec.rb +++ /dev/null @@ -1,58 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe Gitlab::BackgroundMigration::UpdateVulnerabilityConfidence, :migration, schema: 20190909141517 do - let(:vulnerabilities) { table(:vulnerability_occurrences) } - let(:identifiers) { table(:vulnerability_identifiers) } - let(:scanners) { table(:vulnerability_scanners) } - let(:projects) { table(:projects) } - let(:vul1) { attributes_for(:vulnerabilities_occurrence) } - let(:vul2) { attributes_for(:vulnerabilities_occurrence) } - let(:vul3) { attributes_for(:vulnerabilities_occurrence) } - - it 'updates confidence level for container scanning reports' do - projects.create!(id: 123, namespace_id: 12, name: 'gitlab', path: 'gitlab') - - (1..3).to_a.each do |identifier_id| - identifiers.create!(id: identifier_id, - project_id: 123, - fingerprint: 'd432c2ad2953e8bd587a3a43b3ce309b5b0154c' + identifier_id.to_s, - external_type: 'SECURITY_ID', - external_id: 'SECURITY_0', - name: 'SECURITY_IDENTIFIER 0') - end - - scanners.create!(id: 6, project_id: 123, external_id: 'clair', name: 'Security Scanner') - - vulnerabilities.create!(container_scanning_vuln_params(vul1, 1)) - vulnerabilities.create!(container_scanning_vuln_params(vul2, 2)) - vulnerabilities.create!(container_scanning_vuln_params(vul3, 3).merge(report_type: 1)) - - expect(vulnerabilities.where(report_type: 2, confidence: 2).count). to eq(0) - expect(vulnerabilities.exists?(report_type: 2, confidence: 5)).to be_truthy - - described_class.new.perform(1, 3) - - expect(vulnerabilities.exists?(report_type: 2, confidence: 5)).to be_falsy - expect(vulnerabilities.where(report_type: 2, confidence: 2).count). to eq(2) - end - - def container_scanning_vuln_params(vul, primary_identifier_id) - { - id: vul[:id], - severity: 2, - confidence: 5, - report_type: 2, - project_id: 123, - scanner_id: 6, - primary_identifier_id: primary_identifier_id, - project_fingerprint: vul[:project_fingerprint], - location_fingerprint: vul[:location_fingerprint], - uuid: vul[:uuid], - name: vul[:name], - metadata_version: '1.3', - raw_metadata: vul3[:raw_metadata] - } - end -end |