diff options
Diffstat (limited to 'spec/lib/gitlab/instrumentation/redis_interceptor_spec.rb')
-rw-r--r-- | spec/lib/gitlab/instrumentation/redis_interceptor_spec.rb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/spec/lib/gitlab/instrumentation/redis_interceptor_spec.rb b/spec/lib/gitlab/instrumentation/redis_interceptor_spec.rb index 5b5516f100b..02c5dfb7521 100644 --- a/spec/lib/gitlab/instrumentation/redis_interceptor_spec.rb +++ b/spec/lib/gitlab/instrumentation/redis_interceptor_spec.rb @@ -57,8 +57,8 @@ RSpec.describe Gitlab::Instrumentation::RedisInterceptor, :clean_gitlab_redis_sh Gitlab::Redis::SharedState.with do |redis| redis.pipelined do |pipeline| - pipeline.call(:get, 'foobar') - pipeline.call(:get, 'foobarbaz') + pipeline.call(:get, '{foobar}buz') + pipeline.call(:get, '{foobar}baz') end end end @@ -103,11 +103,22 @@ RSpec.describe Gitlab::Instrumentation::RedisInterceptor, :clean_gitlab_redis_sh Gitlab::Redis::SharedState.with do |redis| redis.pipelined do |pipeline| - pipeline.call(:get, 'foobar') - pipeline.call(:get, 'foobarbaz') + pipeline.call(:get, '{foobar}:buz') + pipeline.call(:get, '{foobar}baz') end end end + + it 'raises error when keys are not from the same slot' do + expect do + Gitlab::Redis::SharedState.with do |redis| + redis.pipelined do |pipeline| + pipeline.call(:get, 'foo') + pipeline.call(:get, 'bar') + end + end + end.to raise_error(instance_of(Gitlab::Instrumentation::RedisClusterValidator::CrossSlotError)) + end end end |