Commit 4727b151 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '348135-fix-flaky-redis-session-specs' into 'master'

Fix flaky Redis-Sessions spec

See merge request gitlab-org/gitlab!76690
parents 1faad7e9 d0e94d6d
......@@ -44,20 +44,23 @@ RSpec.describe Gitlab::Redis::Sessions do
describe '#store' do
subject { described_class.store(namespace: described_class::SESSION_NAMESPACE) }
context 'when redis.sessions configuration is provided' do
context 'when redis.sessions configuration is NOT provided' do
it 'instantiates ::Redis instance' do
expect(described_class).to receive(:config_fallback?).and_return(true)
expect(subject).to be_instance_of(::Redis::Store)
end
end
context 'when redis.sessions configuration is not provided' do
context 'when redis.sessions configuration is provided' do
before do
allow(described_class).to receive(:config_fallback?).and_return(false)
end
it 'instantiates an instance of MultiStore' do
expect(described_class).to receive(:config_fallback?).and_return(false)
expect(subject).to be_instance_of(::Gitlab::Redis::MultiStore)
end
end
it_behaves_like 'multi store feature flags', :use_primary_and_secondary_stores_for_sessions, :use_primary_store_as_default_for_sessions
end
end
end
......@@ -8,10 +8,16 @@ RSpec.shared_examples "redis_new_instance_shared_examples" do |name, fallback_cl
let(:fallback_config_file) { nil }
before do
fallback_class.remove_instance_variable(:@_raw_config) rescue nil
allow(fallback_class).to receive(:config_file_name).and_return(fallback_config_file)
end
include_examples "redis_shared_examples"
after do
fallback_class.remove_instance_variable(:@_raw_config) rescue nil
end
it_behaves_like "redis_shared_examples"
describe '.config_file_name' do
subject { described_class.config_file_name }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment