Commit e178d5e5 authored by James Lopez's avatar James Lopez

Merge branch 'use-cache-key-for-invalidation' into 'master'

Use cache_key for invalidating LC  report

See merge request gitlab-org/gitlab!23898
parents c01d0411 f5fb6d8f
......@@ -53,10 +53,6 @@ class SoftwareLicensePolicy < ApplicationRecord
LEGACY_CLASSIFICATION_STATUS.key(classification) || classification
end
def self.workaround_cache_key
pluck(:id, :classification).flatten
end
def self.to_classification(approval_status)
LEGACY_CLASSIFICATION_STATUS.fetch(approval_status, approval_status)
end
......
......@@ -17,7 +17,7 @@ module Ci
private
def key(base_pipeline, head_pipeline)
super(base_pipeline, head_pipeline) + project.software_license_policies.workaround_cache_key
super(base_pipeline, head_pipeline) + [project.software_license_policies.cache_key]
end
end
end
......@@ -523,7 +523,7 @@ describe MergeRequest do
expect_any_instance_of(Ci::CompareLicenseScanningReportsService)
.to receive(:execute).with(base_pipeline, head_pipeline).and_call_original
expect(subject[:key]).to include(*[license_1.id, license_1.classification, license_2.id, license_2.classification])
expect(subject[:key].last).to include("software_license_policies/query-")
end
end
......
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