Commit 76b4367a authored by Sean McGivern's avatar Sean McGivern

Merge branch '208723-load-license-scanning-widget-data-faster' into 'master'

Load license scan data ASAP

See merge request gitlab-org/gitlab!44835
parents 187a3a0d 7315806e
......@@ -31,7 +31,7 @@ module EE
end
def license_scanning_reports
reports_response(merge_request.compare_license_scanning_reports(current_user), head_pipeline)
reports_response(merge_request.compare_license_scanning_reports(current_user))
end
def container_scanning_reports
......
---
title: Load license scanning data in MR widget as soon as the data is available
merge_request: 44835
author:
type: fixed
......@@ -751,7 +751,29 @@ RSpec.describe Projects::MergeRequestsController do
.with(::Ci::CompareLicenseScanningReportsService, viewer).and_return(comparison_status)
end
it_behaves_like 'pending pipeline response'
context 'when the pipeline is running' do
before do
allow(::Gitlab::PollingInterval).to receive(:set_header)
merge_request.head_pipeline.update!(status: :running)
subject
end
context 'when the report is being parsed' do
let(:comparison_status) { { status: :parsing } }
specify { expect(::Gitlab::PollingInterval).to have_received(:set_header) }
specify { expect(response).to have_gitlab_http_status(:no_content) }
end
context 'when the report is ready' do
let(:comparison_status) { { status: :parsed, data: { new_licenses: [], existing_licenses: [], removed_licenses: [] } } }
specify { expect(::Gitlab::PollingInterval).not_to have_received(:set_header) }
specify { expect(response).to have_gitlab_http_status(:ok) }
specify { expect(json_response).to eq({ "new_licenses" => [], "existing_licenses" => [], "removed_licenses" => [] }) }
end
end
context 'when comparison is being processed' do
let(:comparison_status) { { status: :parsing } }
......
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