summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2019-07-09 16:27:05 +0000
committerSean McGivern <sean@gitlab.com>2019-07-09 16:27:05 +0000
commit6d3fede0af1de2106ec5779e33f0571f3e4261d2 (patch)
treeacbc9ed35f044d57f1c67e172531c0baa0de3afe /spec
parent10576b2b3b00425e2f2f04049b3243848f4dca83 (diff)
parent3084c37f3e1e5c1260fbc4a00082300ec0a7b0bd (diff)
downloadgitlab-ce-6d3fede0af1de2106ec5779e33f0571f3e4261d2.tar.gz
Merge branch 'sh-redact-redis-perf-bar' into 'master'
Perform more redactions in Redis performance bar traces Closes #64309 See merge request gitlab-org/gitlab-ce!30514
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/peek/views/redis_detailed_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/lib/peek/views/redis_detailed_spec.rb b/spec/lib/peek/views/redis_detailed_spec.rb
new file mode 100644
index 00000000000..da13b6df53b
--- /dev/null
+++ b/spec/lib/peek/views/redis_detailed_spec.rb
@@ -0,0 +1,36 @@
+# frozen_string_literal: true
+
+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 }
+
+ using RSpec::Parameterized::TableSyntax
+
+ where(:cmd, :expected) do
+ [:auth, 'test'] | 'auth <redacted>'
+ [:set, 'key', 'value'] | 'set key <redacted>'
+ [:set, 'bad'] | 'set bad'
+ [:hmset, 'key1', 'value1', 'key2', 'value2'] | 'hmset key1 <redacted>'
+ [:get, 'key'] | 'get key'
+ end
+
+ with_them do
+ it 'scrubs Redis commands', :request_store do
+ subject.detail_store << { cmd: cmd, duration: 1.second }
+
+ expect(subject.details.count).to eq(1)
+ expect(subject.details.first)
+ .to eq({
+ cmd: expected,
+ duration: 1000
+ })
+ end
+ end
+end