Commit f5fb6d8f authored by Can Eldem's avatar Can Eldem Committed by James Lopez

Use cache_key for invalidating LC report

parent c01d0411
...@@ -53,10 +53,6 @@ class SoftwareLicensePolicy < ApplicationRecord ...@@ -53,10 +53,6 @@ class SoftwareLicensePolicy < ApplicationRecord
LEGACY_CLASSIFICATION_STATUS.key(classification) || classification LEGACY_CLASSIFICATION_STATUS.key(classification) || classification
end end
def self.workaround_cache_key
pluck(:id, :classification).flatten
end
def self.to_classification(approval_status) def self.to_classification(approval_status)
LEGACY_CLASSIFICATION_STATUS.fetch(approval_status, approval_status) LEGACY_CLASSIFICATION_STATUS.fetch(approval_status, approval_status)
end end
......
...@@ -17,7 +17,7 @@ module Ci ...@@ -17,7 +17,7 @@ module Ci
private private
def key(base_pipeline, head_pipeline) 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 end
end end
...@@ -523,7 +523,7 @@ describe MergeRequest do ...@@ -523,7 +523,7 @@ describe MergeRequest do
expect_any_instance_of(Ci::CompareLicenseScanningReportsService) expect_any_instance_of(Ci::CompareLicenseScanningReportsService)
.to receive(:execute).with(base_pipeline, head_pipeline).and_call_original .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
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