diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-11 06:08:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-11 06:08:52 +0300 |
commit | 988f8190b39847793faba06375973f8d4a024426 (patch) | |
tree | bad08d45ee4c080e8631240e8083cd3cfeda088c /spec/lib | |
parent | a18ca85c05efe431c3a1faf6c9f4257638b73493 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/gitlab/github_import/user_finder_spec.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/lib/gitlab/github_import/user_finder_spec.rb b/spec/lib/gitlab/github_import/user_finder_spec.rb index 31118c798e4..998fa8b2c9f 100644 --- a/spec/lib/gitlab/github_import/user_finder_spec.rb +++ b/spec/lib/gitlab/github_import/user_finder_spec.rb @@ -461,6 +461,30 @@ RSpec.describe Gitlab::GithubImport::UserFinder, :clean_gitlab_redis_cache, feat it_behaves_like 'a user resource not found on GitHub' end + + context 'if the cached etag is nil' do + context 'when lock was executed by another process and an email was fetched' do + it 'does not fetch user detail' do + expect(finder).to receive(:read_email_from_cache).ordered.and_return('') + expect(finder).to receive(:read_email_from_cache).ordered.and_return(email) + expect(finder).to receive(:in_lock).and_yield(true) + expect(client).not_to receive(:user) + + email_for_github_username + end + end + + context 'when lock was executed by another process and an email in cache is still blank' do + it 'fetch user detail' do + expect(finder).to receive(:read_email_from_cache).ordered.and_return('') + expect(finder).to receive(:read_email_from_cache).ordered.and_return('') + expect(finder).to receive(:in_lock).and_yield(true) + expect(client).to receive(:user).with(username, { headers: {} }).and_return({ email: email }).once + + email_for_github_username + end + end + end end context 'if the email has been checked for the project' do |