Commit 5d1e73ca authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'network-stats-fix-nil-results' into 'master'

Handle nil results in NetworkPoliciesController#summary

See merge request gitlab-org/gitlab!29213
parents 987b2cc0 8fa79f3b
......@@ -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