diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2019-07-18 16:45:00 +0300 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2019-07-18 16:45:00 +0300 |
commit | 91903d3a9eb3f72dd0684c983fb200ae14a8eb33 (patch) | |
tree | 0224a162251b289df268cfee6d3a899c45085149 /spec | |
parent | 133c9330e5e06d703aaf24d21d5beb70b67e5e2d (diff) | |
parent | 9dd59df6991b9d82bcbb95bf406194aab8ecf743 (diff) |
Merge branch 'sh-fix-redis-performance-bar' into 'master'
Fix inconsistency in Redis performance bar stats
Closes #64707
See merge request gitlab-org/gitlab-ce!30866
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/peek/views/redis_detailed_spec.rb | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/spec/lib/peek/views/redis_detailed_spec.rb b/spec/lib/peek/views/redis_detailed_spec.rb index da13b6df53b..61096e6c69e 100644 --- a/spec/lib/peek/views/redis_detailed_spec.rb +++ b/spec/lib/peek/views/redis_detailed_spec.rb @@ -2,14 +2,8 @@ require 'spec_helper' -describe Peek::Views::RedisDetailed do - let(:redis_detailed_class) do - Class.new do - include Peek::Views::RedisDetailed - end - end - - subject { redis_detailed_class.new } +describe Peek::Views::RedisDetailed, :request_store do + subject { described_class.new } using RSpec::Parameterized::TableSyntax @@ -22,15 +16,24 @@ describe Peek::Views::RedisDetailed do end with_them do - it 'scrubs Redis commands', :request_store do + it 'scrubs Redis commands' do subject.detail_store << { cmd: cmd, duration: 1.second } - expect(subject.details.count).to eq(1) - expect(subject.details.first) + expect(subject.results[:details].count).to eq(1) + expect(subject.results[:details].first) .to eq({ cmd: expected, duration: 1000 }) end end + + it 'returns aggregated results' do + subject.detail_store << { cmd: [:get, 'test'], duration: 0.001 } + subject.detail_store << { cmd: [:get, 'test'], duration: 1.second } + + expect(subject.results[:calls]).to eq(2) + expect(subject.results[:duration]).to eq('1001.00ms') + expect(subject.results[:details].count).to eq(2) + end end |