diff options
Diffstat (limited to 'spec/tasks/gitlab/cleanup_rake_spec.rb')
-rw-r--r-- | spec/tasks/gitlab/cleanup_rake_spec.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/spec/tasks/gitlab/cleanup_rake_spec.rb b/spec/tasks/gitlab/cleanup_rake_spec.rb index 16c907ca87c..bd4d9643433 100644 --- a/spec/tasks/gitlab/cleanup_rake_spec.rb +++ b/spec/tasks/gitlab/cleanup_rake_spec.rb @@ -166,17 +166,17 @@ RSpec.describe 'gitlab:cleanup rake tasks', :silence_stdout do end context 'sessions' do - describe 'gitlab:cleanup:sessions:active_sessions_lookup_keys', :clean_gitlab_redis_shared_state do + describe 'gitlab:cleanup:sessions:active_sessions_lookup_keys', :clean_gitlab_redis_sessions do subject(:rake_task) { run_rake_task('gitlab:cleanup:sessions:active_sessions_lookup_keys') } let!(:user) { create(:user) } let(:existing_session_id) { '5' } before do - Gitlab::Redis::SharedState.with do |redis| - redis.set("session:user:gitlab:#{user.id}:#{existing_session_id}", - Marshal.dump(true)) - redis.sadd("session:lookup:user:gitlab:#{user.id}", (1..10).to_a) + Gitlab::Redis::Sessions.with do |redis| + redis.set(ActiveSession.key_name(user.id, existing_session_id), + ActiveSession.new(session_id: 'x').dump) + redis.sadd(ActiveSession.lookup_key_name(user.id), (1..10).to_a) end end @@ -185,11 +185,11 @@ RSpec.describe 'gitlab:cleanup rake tasks', :silence_stdout do end it 'removes expired active session lookup keys' do - Gitlab::Redis::SharedState.with do |redis| - lookup_key = "session:lookup:user:gitlab:#{user.id}" + Gitlab::Redis::Sessions.with do |redis| + lookup_key = ActiveSession.lookup_key_name(user.id) + expect { subject }.to change { redis.scard(lookup_key) }.from(10).to(1) - expect(redis.smembers("session:lookup:user:gitlab:#{user.id}")).to( - eql([existing_session_id])) + expect(redis.smembers(lookup_key)).to contain_exactly existing_session_id end end end |