debian-mirror-gitlab/spec/lib/gitlab/redis/sessions_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
972 B
Ruby
Raw Permalink Normal View History

2021-11-18 22:05:49 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Gitlab::Redis::Sessions do
2022-01-26 12:08:38 +05:30
it_behaves_like "redis_new_instance_shared_examples", 'sessions', Gitlab::Redis::SharedState
describe 'redis instance used in connection pool' do
2022-03-02 08:16:31 +05:30
around do |example|
2022-01-26 12:08:38 +05:30
clear_pool
2022-03-02 08:16:31 +05:30
example.run
ensure
2022-01-26 12:08:38 +05:30
clear_pool
end
2022-03-02 08:16:31 +05:30
it 'uses ::Redis instance' do
described_class.pool.with do |redis_instance|
expect(redis_instance).to be_instance_of(::Redis)
2022-01-26 12:08:38 +05:30
end
end
def clear_pool
described_class.remove_instance_variable(:@pool)
rescue NameError
# raised if @pool was not set; ignore
end
end
describe '#store' do
subject(:store) { described_class.store(namespace: described_class::SESSION_NAMESPACE) }
2022-03-02 08:16:31 +05:30
# Check that Gitlab::Redis::Sessions is configured as RedisStore.
it 'instantiates an instance of Redis::Store' do
expect(store).to be_instance_of(::Redis::Store)
2022-01-26 12:08:38 +05:30
end
end
2021-11-18 22:05:49 +05:30
end