Commit 8fa79f3b authored by Arthur Evstifeev's avatar Arthur Evstifeev Committed by Heinrich Lee Yu

Handle nil results in NetworkPoliciesController#summary

parent b9997292
......@@ -19,7 +19,7 @@ module Projects
interval: params[:interval] || "minute",
from: (Time.parse(params[:from]) rescue 1.hour.ago),
to: (Time.parse(params[:to]) rescue Time.now)
)
) || {}
respond_to do |format|
format.json do
......
......@@ -88,6 +88,15 @@ describe Projects::Security::NetworkPoliciesController do
end
end
end
context 'with nil results' do
it 'returns network policies summary' do
allow(adapter).to receive(:query).and_return(nil)
subject
expect(response).to have_gitlab_http_status(:bad_request)
end
end
end
context 'without prometheus configured' 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