Commit 28e91aea authored by Tetiana Chupryna's avatar Tetiana Chupryna Committed by Dmytro Zaporozhets

Use `license_scanning` feature

All code related to `license_management` is scheduled
to be deprecated after 13.0 https://gitlab.com/gitlab-org/gitlab/-/issues/8912
parent 5e05c233
...@@ -73,7 +73,7 @@ module EE ...@@ -73,7 +73,7 @@ module EE
each_report(::Ci::JobArtifact::LICENSE_SCANNING_REPORT_FILE_TYPES) do |file_type, blob| each_report(::Ci::JobArtifact::LICENSE_SCANNING_REPORT_FILE_TYPES) do |file_type, blob|
next if ::Feature.disabled?(:parse_license_management_reports, default_enabled: true) next if ::Feature.disabled?(:parse_license_management_reports, default_enabled: true)
next unless project.feature_available?(:license_management) next unless project.feature_available?(:license_scanning) || project.feature_available?(:license_management)
::Gitlab::Ci::Parsers.fabricate!(file_type).parse!(blob, license_scanning_report) ::Gitlab::Ci::Parsers.fabricate!(file_type).parse!(blob, license_scanning_report)
end end
......
...@@ -45,8 +45,8 @@ module EE ...@@ -45,8 +45,8 @@ module EE
container_scanning: %i[container_scanning sast_container], container_scanning: %i[container_scanning sast_container],
dast: %i[dast], dast: %i[dast],
performance: %i[merge_request_performance_metrics], performance: %i[merge_request_performance_metrics],
license_management: %i[license_management], license_management: %i[license_scanning license_management],
license_scanning: %i[license_management], license_scanning: %i[license_scanning license_management],
metrics: %i[metrics_reports] metrics: %i[metrics_reports]
}.freeze }.freeze
......
...@@ -22,7 +22,7 @@ describe Projects::DependenciesController do ...@@ -22,7 +22,7 @@ describe Projects::DependenciesController do
context 'when feature is available' do context 'when feature is available' do
before do before do
stub_licensed_features(dependency_scanning: true, license_management: true, security_dashboard: true) stub_licensed_features(dependency_scanning: true, license_scanning: true, security_dashboard: true)
end end
context 'when requesting HTML' do context 'when requesting HTML' do
......
...@@ -16,7 +16,7 @@ describe Projects::LicensesController do ...@@ -16,7 +16,7 @@ describe Projects::LicensesController do
context 'with authorized user' do context 'with authorized user' do
context 'when feature is available' do context 'when feature is available' do
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
context 'with reporter' do context 'with reporter' do
...@@ -280,7 +280,7 @@ describe Projects::LicensesController do ...@@ -280,7 +280,7 @@ describe Projects::LicensesController do
context 'with unauthorized user' do context 'with unauthorized user' do
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
get_licenses get_licenses
end end
...@@ -309,7 +309,7 @@ describe Projects::LicensesController do ...@@ -309,7 +309,7 @@ describe Projects::LicensesController do
let(:current_user) { create(:user) } let(:current_user) { create(:user) }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
sign_in(current_user) sign_in(current_user)
end end
...@@ -427,7 +427,7 @@ describe Projects::LicensesController do ...@@ -427,7 +427,7 @@ describe Projects::LicensesController do
let(:current_user) { create(:user) } let(:current_user) { create(:user) }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
sign_in(current_user) sign_in(current_user)
end end
......
...@@ -84,7 +84,7 @@ describe Projects::PipelinesController do ...@@ -84,7 +84,7 @@ describe Projects::PipelinesController do
context 'with feature enabled' do context 'with feature enabled' do
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
licenses_with_html licenses_with_html
end end
...@@ -96,7 +96,7 @@ describe Projects::PipelinesController do ...@@ -96,7 +96,7 @@ describe Projects::PipelinesController do
context 'with feature enabled json' do context 'with feature enabled json' do
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
it 'will return license management report in json format' do it 'will return license management report in json format' do
...@@ -141,7 +141,7 @@ describe Projects::PipelinesController do ...@@ -141,7 +141,7 @@ describe Projects::PipelinesController do
context 'without license management artifact' do context 'without license management artifact' do
context 'with feature enabled' do context 'with feature enabled' do
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
licenses_with_html licenses_with_html
end end
...@@ -152,7 +152,7 @@ describe Projects::PipelinesController do ...@@ -152,7 +152,7 @@ describe Projects::PipelinesController do
context 'with feature enabled json' do context 'with feature enabled json' do
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
licenses_with_json licenses_with_json
end end
......
...@@ -11,7 +11,7 @@ describe 'EE > Projects > Licenses > Maintainer views policies', :js do ...@@ -11,7 +11,7 @@ describe 'EE > Projects > Licenses > Maintainer views policies', :js do
end end
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
sign_in(maintainer) sign_in(maintainer)
visit(project_licenses_path(project)) visit(project_licenses_path(project))
......
...@@ -131,7 +131,7 @@ describe 'Pipeline', :js do ...@@ -131,7 +131,7 @@ describe 'Pipeline', :js do
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id) } let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id) }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
context 'with a License Compliance artifact' do context 'with a License Compliance artifact' do
......
...@@ -15,7 +15,7 @@ describe SoftwareLicensePoliciesFinder do ...@@ -15,7 +15,7 @@ describe SoftwareLicensePoliciesFinder do
let(:finder) { described_class.new(user, project, params) } let(:finder) { described_class.new(user, project, params) }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
context 'searched by name' do context 'searched by name' do
......
...@@ -369,7 +369,7 @@ describe ApprovalMergeRequestRule do ...@@ -369,7 +369,7 @@ describe ApprovalMergeRequestRule do
describe "#refresh_required_approvals!" do describe "#refresh_required_approvals!" do
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
context "when the rule is a `#{ApprovalRuleLike::DEFAULT_NAME_FOR_LICENSE_REPORT}` rule" do context "when the rule is a `#{ApprovalRuleLike::DEFAULT_NAME_FOR_LICENSE_REPORT}` rule" do
......
...@@ -198,7 +198,7 @@ describe Ci::Build do ...@@ -198,7 +198,7 @@ describe Ci::Build do
let(:license_scanning_report) { Gitlab::Ci::Reports::LicenseScanning::Report.new } let(:license_scanning_report) { Gitlab::Ci::Reports::LicenseScanning::Report.new }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
it { expect(license_scanning_report.licenses.count).to eq(0) } it { expect(license_scanning_report.licenses.count).to eq(0) }
...@@ -243,7 +243,7 @@ describe Ci::Build do ...@@ -243,7 +243,7 @@ describe Ci::Build do
context 'when the license management feature is disabled' do context 'when the license management feature is disabled' do
before do before do
stub_licensed_features(license_management: false) stub_licensed_features(license_scanning: false)
create(:ee_ci_job_artifact, :license_management, job: job, project: job.project) create(:ee_ci_job_artifact, :license_management, job: job, project: job.project)
end end
...@@ -344,7 +344,7 @@ describe Ci::Build do ...@@ -344,7 +344,7 @@ describe Ci::Build do
context 'when license does not have metrics_reports' do context 'when license does not have metrics_reports' do
before do before do
stub_licensed_features(license_management: false) stub_licensed_features(license_scanning: false)
end end
it 'does not parse metrics report' do it 'does not parse metrics report' do
......
...@@ -91,7 +91,7 @@ describe Ci::Pipeline do ...@@ -91,7 +91,7 @@ describe Ci::Pipeline do
context 'with license compliance artifact' do context 'with license compliance artifact' do
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
[:license_management, :license_scanning].each do |artifact_type| [:license_management, :license_scanning].each do |artifact_type|
...@@ -120,7 +120,7 @@ describe Ci::Pipeline do ...@@ -120,7 +120,7 @@ describe Ci::Pipeline do
subject { pipeline.expose_license_scanning_data? } subject { pipeline.expose_license_scanning_data? }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
[:license_scanning, :license_management].each do |artifact_type| [:license_scanning, :license_management].each do |artifact_type|
...@@ -247,7 +247,7 @@ describe Ci::Pipeline do ...@@ -247,7 +247,7 @@ describe Ci::Pipeline do
subject { pipeline.license_scanning_report } subject { pipeline.license_scanning_report }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
context 'when pipeline has multiple builds with license management reports' do context 'when pipeline has multiple builds with license management reports' do
......
...@@ -10,7 +10,7 @@ RSpec.describe SCA::LicenseCompliance do ...@@ -10,7 +10,7 @@ RSpec.describe SCA::LicenseCompliance do
let(:other_license) { create(:software_license, spdx_identifier: "Other-Id") } let(:other_license) { create(:software_license, spdx_identifier: "Other-Id") }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
describe "#policies" do describe "#policies" do
......
...@@ -21,7 +21,7 @@ describe ProjectPolicy do ...@@ -21,7 +21,7 @@ describe ProjectPolicy do
project.add_developer(developer) project.add_developer(developer)
project.add_reporter(reporter) project.add_reporter(reporter)
project.add_guest(guest) project.add_guest(guest)
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
context 'basic permissions' do context 'basic permissions' do
...@@ -68,7 +68,7 @@ describe ProjectPolicy do ...@@ -68,7 +68,7 @@ describe ProjectPolicy do
let(:current_user) { create(:user, :auditor) } let(:current_user) { create(:user, :auditor) }
before do before do
stub_licensed_features(security_dashboard: true, license_management: true, threat_monitoring: true) stub_licensed_features(security_dashboard: true, license_scanning: true, threat_monitoring: true)
end end
context 'who is not a team member' do context 'who is not a team member' do
...@@ -696,7 +696,7 @@ describe ProjectPolicy do ...@@ -696,7 +696,7 @@ describe ProjectPolicy do
describe 'admin_license_management' do describe 'admin_license_management' do
context 'without license management feature available' do context 'without license management feature available' do
before do before do
stub_licensed_features(license_management: false) stub_licensed_features(license_scanning: false)
end end
let(:current_user) { admin } let(:current_user) { admin }
...@@ -756,7 +756,7 @@ describe ProjectPolicy do ...@@ -756,7 +756,7 @@ describe ProjectPolicy do
describe 'read_software_license_policy' do describe 'read_software_license_policy' do
context 'without license management feature available' do context 'without license management feature available' do
before do before do
stub_licensed_features(license_management: false) stub_licensed_features(license_scanning: false)
end end
let(:current_user) { admin } let(:current_user) { admin }
...@@ -890,7 +890,7 @@ describe ProjectPolicy do ...@@ -890,7 +890,7 @@ describe ProjectPolicy do
context 'when license management feature in not available' do context 'when license management feature in not available' do
before do before do
stub_licensed_features(license_management: false) stub_licensed_features(license_scanning: false)
end end
let(:current_user) { admin } let(:current_user) { admin }
......
...@@ -30,7 +30,7 @@ describe Ci::PipelinePresenter do ...@@ -30,7 +30,7 @@ describe Ci::PipelinePresenter do
context 'when features are available' do context 'when features are available' do
before do before do
stub_licensed_features(dependency_scanning: true, license_management: true) stub_licensed_features(dependency_scanning: true, license_scanning: true)
end end
context 'when there is an artifact of a right type' do context 'when there is an artifact of a right type' do
......
...@@ -10,7 +10,7 @@ describe API::ManagedLicenses do ...@@ -10,7 +10,7 @@ describe API::ManagedLicenses do
let_it_be(:software_license_policy) { create(:software_license_policy, project: project) } let_it_be(:software_license_policy) { create(:software_license_policy, project: project) }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
project.add_maintainer(maintainer_user) project.add_maintainer(maintainer_user)
project.add_developer(dev_user) project.add_developer(dev_user)
project.add_reporter(reporter_user) project.add_reporter(reporter_user)
...@@ -19,7 +19,7 @@ describe API::ManagedLicenses do ...@@ -19,7 +19,7 @@ describe API::ManagedLicenses do
describe 'GET /projects/:id/managed_licenses' do describe 'GET /projects/:id/managed_licenses' do
context 'with license management not available' do context 'with license management not available' do
before do before do
stub_licensed_features(license_management: false) stub_licensed_features(license_scanning: false)
end end
it 'returns a forbidden status' do it 'returns a forbidden status' do
......
...@@ -18,7 +18,7 @@ describe DependencyEntity do ...@@ -18,7 +18,7 @@ describe DependencyEntity do
context 'when all required features available' do context 'when all required features available' do
before do before do
stub_licensed_features(security_dashboard: true, license_management: true) stub_licensed_features(security_dashboard: true, license_scanning: true)
allow(request).to receive(:project).and_return(project) allow(request).to receive(:project).and_return(project)
allow(request).to receive(:user).and_return(user) allow(request).to receive(:user).and_return(user)
end end
......
...@@ -13,7 +13,7 @@ describe DependencyListSerializer do ...@@ -13,7 +13,7 @@ describe DependencyListSerializer do
end end
before do before do
stub_licensed_features(security_dashboard: true, license_management: true) stub_licensed_features(security_dashboard: true, license_scanning: true)
project.add_developer(user) project.add_developer(user)
end end
......
...@@ -7,7 +7,7 @@ describe LicensesListEntity do ...@@ -7,7 +7,7 @@ describe LicensesListEntity do
let(:license_compliance) { ::SCA::LicenseCompliance.new(project) } let(:license_compliance) { ::SCA::LicenseCompliance.new(project) }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
it_behaves_like 'report list' do it_behaves_like 'report list' do
......
...@@ -18,7 +18,7 @@ describe LicensesListSerializer do ...@@ -18,7 +18,7 @@ describe LicensesListSerializer do
before do before do
project.add_guest(user) project.add_guest(user)
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
it { is_expected.to match_schema('licenses_list', dir: 'ee') } it { is_expected.to match_schema('licenses_list', dir: 'ee') }
......
...@@ -124,7 +124,7 @@ describe MergeRequestWidgetEntity do ...@@ -124,7 +124,7 @@ describe MergeRequestWidgetEntity do
context 'when feature is not licensed' do context 'when feature is not licensed' do
before do before do
stub_licensed_features(license_management: false) stub_licensed_features(license_scanning: false)
end end
it 'is not included' do it 'is not included' do
...@@ -178,7 +178,7 @@ describe MergeRequestWidgetEntity do ...@@ -178,7 +178,7 @@ describe MergeRequestWidgetEntity do
describe '#license_scanning', :request_store do describe '#license_scanning', :request_store do
before do before do
allow(merge_request).to receive_messages(head_pipeline: pipeline, target_project: project) allow(merge_request).to receive_messages(head_pipeline: pipeline, target_project: project)
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
it 'is not included, if missing artifacts' do it 'is not included, if missing artifacts' do
...@@ -201,7 +201,7 @@ describe MergeRequestWidgetEntity do ...@@ -201,7 +201,7 @@ describe MergeRequestWidgetEntity do
context 'when feature is not licensed' do context 'when feature is not licensed' do
before do before do
stub_licensed_features(license_management: false) stub_licensed_features(license_scanning: false)
end end
it 'is not included' do it 'is not included' do
...@@ -238,7 +238,7 @@ describe MergeRequestWidgetEntity do ...@@ -238,7 +238,7 @@ describe MergeRequestWidgetEntity do
before do before do
allow(fork_merge_request).to receive_messages(head_pipeline: pipeline) allow(fork_merge_request).to receive_messages(head_pipeline: pipeline)
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
it 'is a path for target project' do it 'is a path for target project' do
......
...@@ -8,7 +8,7 @@ describe Ci::CompareLicenseScanningReportsService do ...@@ -8,7 +8,7 @@ describe Ci::CompareLicenseScanningReportsService do
let(:project) { create(:project, :repository) } let(:project) { create(:project, :repository) }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
describe '#execute' do describe '#execute' do
......
...@@ -15,7 +15,7 @@ describe Projects::Licenses::UpdatePolicyService do ...@@ -15,7 +15,7 @@ describe Projects::Licenses::UpdatePolicyService do
context "when the user is authorized" do context "when the user is authorized" do
before do before do
allow(RefreshLicenseComplianceChecksWorker).to receive(:perform_async) allow(RefreshLicenseComplianceChecksWorker).to receive(:perform_async)
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
project.add_maintainer(user) project.add_maintainer(user)
end end
......
...@@ -13,7 +13,7 @@ describe Security::SyncReportsToApprovalRulesService, '#execute' do ...@@ -13,7 +13,7 @@ describe Security::SyncReportsToApprovalRulesService, '#execute' do
before do before do
allow(Ci::Pipeline).to receive(:find).with(pipeline.id) { pipeline } allow(Ci::Pipeline).to receive(:find).with(pipeline.id) { pipeline }
stub_licensed_features(dependency_scanning: true, dast: true, license_management: true) stub_licensed_features(dependency_scanning: true, dast: true, license_scanning: true)
end end
context 'when there are reports' do context 'when there are reports' do
......
...@@ -13,7 +13,7 @@ describe SoftwareLicensePolicies::CreateService do ...@@ -13,7 +13,7 @@ describe SoftwareLicensePolicies::CreateService do
end end
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
subject { described_class.new(project, user, params) } subject { described_class.new(project, user, params) }
...@@ -21,7 +21,7 @@ describe SoftwareLicensePolicies::CreateService do ...@@ -21,7 +21,7 @@ describe SoftwareLicensePolicies::CreateService do
describe '#execute' do describe '#execute' do
context 'with license management unavailable' do context 'with license management unavailable' do
before do before do
stub_licensed_features(license_management: false) stub_licensed_features(license_scanning: false)
end end
it 'does not creates a software license policy' do it 'does not creates a software license policy' do
......
...@@ -14,7 +14,7 @@ describe SoftwareLicensePolicies::UpdateService do ...@@ -14,7 +14,7 @@ describe SoftwareLicensePolicies::UpdateService do
let(:software_license_policy) { create(:software_license_policy, :denied) } let(:software_license_policy) { create(:software_license_policy, :denied) }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
describe '#execute' do describe '#execute' do
...@@ -29,7 +29,7 @@ describe SoftwareLicensePolicies::UpdateService do ...@@ -29,7 +29,7 @@ describe SoftwareLicensePolicies::UpdateService do
context 'with license management unavailable' do context 'with license management unavailable' do
before do before do
stub_licensed_features(license_management: false) stub_licensed_features(license_scanning: false)
end end
it 'does not update the software license policy' do it 'does not update the software license policy' do
......
...@@ -9,7 +9,7 @@ describe RefreshLicenseComplianceChecksWorker do ...@@ -9,7 +9,7 @@ describe RefreshLicenseComplianceChecksWorker do
let(:project) { create(:project) } let(:project) { create(:project) }
before do before do
stub_licensed_features(license_management: true) stub_licensed_features(license_scanning: true)
end end
context "when there are merge requests associated with the project" do context "when there are merge requests associated with the project" 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