diff options
author | Stan Hu <stanhu@gmail.com> | 2019-07-23 22:12:42 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-07-23 22:12:42 -0700 |
commit | 02a27937255f7815ce8d87ea044d4426848f2841 (patch) | |
tree | af35c6b080895bbbfca5d86ae0ebb6e0c2fe75b9 | |
parent | 291df05e434f5678c47bce9521ff15748d6c767f (diff) | |
download | gitlab-ce-02a27937255f7815ce8d87ea044d4426848f2841.tar.gz |
Hide Rugged data if it doesn't exist
-rw-r--r-- | lib/peek/views/rugged.rb | 2 | ||||
-rw-r--r-- | spec/lib/peek/views/rugged_spec.rb | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/peek/views/rugged.rb b/lib/peek/views/rugged.rb index 7e2730e2ae4..7b0ab162b15 100644 --- a/lib/peek/views/rugged.rb +++ b/lib/peek/views/rugged.rb @@ -12,6 +12,8 @@ module Peek end def results + return {} unless calls > 0 + { duration: formatted_duration, calls: calls, diff --git a/spec/lib/peek/views/rugged_spec.rb b/spec/lib/peek/views/rugged_spec.rb index 0fc75043df8..715b360953c 100644 --- a/spec/lib/peek/views/rugged_spec.rb +++ b/spec/lib/peek/views/rugged_spec.rb @@ -11,6 +11,10 @@ describe Peek::Views::Rugged, :request_store do allow(Gitlab::RuggedInstrumentation).to receive(:peek_enabled?).and_return(true) end + it 'returns no results' do + expect(subject.results).to eq({}) + end + it 'returns aggregated results' do ::Gitlab::RuggedInstrumentation.query_time += 1.234 ::Gitlab::RuggedInstrumentation.increment_query_count |