Commit 56e516a5 authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch '8911-fix-license-comliance-with-new-artifact' into 'master'

Empty Licenses list and new artifact name

See merge request gitlab-org/gitlab!23267
parents 6ec84d45 76d40559
......@@ -24,7 +24,7 @@ module EE
after_save :stick_build_if_status_changed
delegate :service_specification, to: :runner_session, allow_nil: true
scope :license_scan, -> { joins(:job_artifacts).merge(::Ci::JobArtifact.license_management) }
scope :license_scan, -> { joins(:job_artifacts).merge(::Ci::JobArtifact.license_scanning_reports) }
scope :max_build_id_by, -> (build_name, ref, project_path) do
select('max(ci_builds.id) as id')
.by_name(build_name)
......
......@@ -120,7 +120,7 @@ FactoryBot.define do
after(:build) do |artifact, _|
artifact.file = fixture_file_upload(
Rails.root.join('ee/spec/fixtures/security_reports/master/gl-license-management-report.json'), 'application/json')
Rails.root.join('ee/spec/fixtures/security_reports/deprecated/gl-license-management-report.json'), 'application/json')
end
end
......@@ -130,7 +130,7 @@ FactoryBot.define do
after(:build) do |artifact, _|
artifact.file = fixture_file_upload(
Rails.root.join('ee/spec/fixtures/security_reports/master/gl-license-management-report.json'), 'application/json')
Rails.root.join('ee/spec/fixtures/security_reports/master/gl-license-scanning-report.json'), 'application/json')
end
end
......
......@@ -7,7 +7,7 @@ describe Gitlab::Ci::Parsers::LicenseCompliance::LicenseScanning do
let(:report) { Gitlab::Ci::Reports::LicenseScanning::Report.new }
context 'when parsing a valid v1 report' do
let(:v1_json) { fixture_file('security_reports/master/gl-license-management-report.json', dir: 'ee') }
let(:v1_json) { fixture_file('security_reports/master/gl-license-scanning-report.json', dir: 'ee') }
before do
subject.parse!(v1_json, report)
......
......@@ -270,7 +270,7 @@ describe Gitlab::Ci::Reports::LicenseScanning::Report do
context 'when parsing a v1 report' do
subject { described_class.parse_from(v1_json) }
let(:v1_json) { fixture_file('security_reports/master/gl-license-management-report.json', dir: 'ee') }
let(:v1_json) { fixture_file('security_reports/master/gl-license-scanning-report.json', dir: 'ee') }
it { expect(subject.version).to eql('1.0') }
it { expect(subject.licenses.count).to eq(4) }
......
......@@ -16,6 +16,24 @@ describe Ci::Build do
let(:job) { create(:ci_build, pipeline: pipeline) }
let(:artifact) { create(:ee_ci_job_artifact, :sast, job: job, project: job.project) }
describe '.license_scan' do
subject(:build) { described_class.license_scan.first }
let(:artifact) { build.job_artifacts.first }
context 'with old license_management artifact' do
let!(:license_artifact) { create(:ee_ci_job_artifact, :license_management, job: job, project: job.project) }
it { expect(artifact.file_type).to eq 'license_management' }
end
context 'with new license_scanning artifact' do
let!(:license_artifact) { create(:ee_ci_job_artifact, :license_scanning, job: job, project: job.project) }
it { expect(artifact.file_type).to eq 'license_scanning' }
end
end
describe '#shared_runners_minutes_limit_enabled?' do
subject { job.shared_runners_minutes_limit_enabled? }
......@@ -24,7 +42,7 @@ describe Ci::Build do
job.runner = create(:ci_runner, :instance)
end
it do
specify do
expect(job.project).to receive(:shared_runners_minutes_limit_enabled?)
.and_return(true)
......
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