Commit a665ef1c authored by Tetiana Chupryna's avatar Tetiana Chupryna Committed by Heinrich Lee Yu

Fix issue with new license_scanning artifact

parent 1ae92eb0
...@@ -24,7 +24,7 @@ module EE ...@@ -24,7 +24,7 @@ module EE
after_save :stick_build_if_status_changed after_save :stick_build_if_status_changed
delegate :service_specification, to: :runner_session, allow_nil: true 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 scope :max_build_id_by, -> (build_name, ref, project_path) do
select('max(ci_builds.id) as id') select('max(ci_builds.id) as id')
.by_name(build_name) .by_name(build_name)
......
...@@ -16,6 +16,23 @@ describe Ci::Build do ...@@ -16,6 +16,23 @@ describe Ci::Build do
let(:job) { create(:ci_build, pipeline: pipeline) } let(:job) { create(:ci_build, pipeline: pipeline) }
let(:artifact) { create(:ee_ci_job_artifact, :sast, job: job, project: job.project) } 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 describe '#shared_runners_minutes_limit_enabled?' do
subject { job.shared_runners_minutes_limit_enabled? } subject { job.shared_runners_minutes_limit_enabled? }
......
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