Hide Rugged data if it doesn't exist
This commit is contained in:
parent
291df05e43
commit
02a2793725
2 changed files with 6 additions and 0 deletions
|
@ -12,6 +12,8 @@ module Peek
|
||||||
end
|
end
|
||||||
|
|
||||||
def results
|
def results
|
||||||
|
return {} unless calls > 0
|
||||||
|
|
||||||
{
|
{
|
||||||
duration: formatted_duration,
|
duration: formatted_duration,
|
||||||
calls: calls,
|
calls: calls,
|
||||||
|
|
|
@ -11,6 +11,10 @@ describe Peek::Views::Rugged, :request_store do
|
||||||
allow(Gitlab::RuggedInstrumentation).to receive(:peek_enabled?).and_return(true)
|
allow(Gitlab::RuggedInstrumentation).to receive(:peek_enabled?).and_return(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'returns no results' do
|
||||||
|
expect(subject.results).to eq({})
|
||||||
|
end
|
||||||
|
|
||||||
it 'returns aggregated results' do
|
it 'returns aggregated results' do
|
||||||
::Gitlab::RuggedInstrumentation.query_time += 1.234
|
::Gitlab::RuggedInstrumentation.query_time += 1.234
|
||||||
::Gitlab::RuggedInstrumentation.increment_query_count
|
::Gitlab::RuggedInstrumentation.increment_query_count
|
||||||
|
|
Loading…
Reference in a new issue