Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-03 00:06:51 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-03 00:06:51 +0300
commita19a376bf35b2009566e86b8190662c21ed7e2ba (patch)
tree46d3ea7f44a0a732b96fcbae0cf09d3cfd8ec9dc /spec/models/active_session_spec.rb
parent556c79d6cc3d7b24ecbba3a79f8432eb3fcf5c7e (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/models/active_session_spec.rb')
-rw-r--r--spec/models/active_session_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/active_session_spec.rb b/spec/models/active_session_spec.rb
index 07f716c4f38..c26675e75bf 100644
--- a/spec/models/active_session_spec.rb
+++ b/spec/models/active_session_spec.rb
@@ -307,6 +307,28 @@ RSpec.describe ActiveSession, :clean_gitlab_redis_shared_state do
expect(lookup_entries).not_to include(max_number_of_sessions_plus_one.to_s, max_number_of_sessions_plus_two.to_s)
end
end
+
+ it 'removes obsolete lookup entries even without active session' do
+ Gitlab::Redis::SharedState.with do |redis|
+ redis.sadd(
+ "session:lookup:user:gitlab:#{user.id}",
+ "#{max_number_of_sessions_plus_two + 1}"
+ )
+ end
+
+ ActiveSession.cleanup(user)
+
+ Gitlab::Redis::SharedState.with do |redis|
+ lookup_entries = redis.smembers("session:lookup:user:gitlab:#{user.id}")
+
+ expect(lookup_entries.count).to eq(ActiveSession::ALLOWED_NUMBER_OF_ACTIVE_SESSIONS)
+ expect(lookup_entries).not_to include(
+ max_number_of_sessions_plus_one.to_s,
+ max_number_of_sessions_plus_two.to_s,
+ (max_number_of_sessions_plus_two + 1).to_s
+ )
+ end
+ end
end
end
end