summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/instrumentation/redis_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/instrumentation/redis_spec.rb')
-rw-r--r--spec/lib/gitlab/instrumentation/redis_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/lib/gitlab/instrumentation/redis_spec.rb b/spec/lib/gitlab/instrumentation/redis_spec.rb
index 6cddf958f2a..ebc2e92a0dd 100644
--- a/spec/lib/gitlab/instrumentation/redis_spec.rb
+++ b/spec/lib/gitlab/instrumentation/redis_spec.rb
@@ -28,6 +28,13 @@ RSpec.describe Gitlab::Instrumentation::Redis do
describe '.payload', :request_store do
before do
+ # If this is the first spec in a spec run that uses Redis, there
+ # will be an extra SELECT command to choose the right database. We
+ # don't want to make the spec less precise, so we force that to
+ # happen (if needed) first, then clear the counts.
+ Gitlab::Redis::Cache.with { |redis| redis.info }
+ RequestStore.clear!
+
Gitlab::Redis::Cache.with { |redis| redis.set('cache-test', 321) }
Gitlab::Redis::SharedState.with { |redis| redis.set('shared-state-test', 123) }
end