Skip to content
Snippets Groups Projects
Verified Commit e6026791 authored by Jenny Kim's avatar Jenny Kim Committed by GitLab
Browse files

Merge branch 'cherry-pick-12379b8f' into '17-7-stable-ee'

Backport into 17.7: Decrease log level of false error

See merge request !180574



Merged-by: default avatarJenny Kim <yjeankim@gitlab.com>
Approved-by: default avatarDouglas Barbosa Alexandre <dbalexandre@gmail.com>
Co-authored-by: default avatarAakriti Gupta <agupta@gitlab.com>
parents 965b8d1b 2ced7f5f
No related branches found
No related tags found
1 merge request!180574Backport into 17.7: Decrease log level of false error
Pipeline #1661073515 passed
......@@ -134,7 +134,7 @@ def update_root_ref(remote_url, authorization)
root_ref = find_remote_root_ref(remote_url, authorization)
change_head(root_ref) if root_ref.present?
rescue ::Gitlab::Git::Repository::NoRepository => e
::Gitlab::AppLogger.error("Error updating root ref for repository #{full_path} (#{container.id}): #{e.message}.")
::Gitlab::AppLogger.info("Error updating root ref for repository #{full_path} (#{container.id}): #{e.message}.")
nil
end
......
......@@ -372,12 +372,28 @@ def create_remote_branch(remote_name, branch_name, target)
.not_to change { project.default_branch }
end
it 'does not raise error when repository does not exist' do
allow(repository).to receive(:find_remote_root_ref)
.with(url, auth)
.and_raise(Gitlab::Git::Repository::NoRepository)
context 'when project repo is missing' do
before do
allow(repository).to receive(:find_remote_root_ref)
.with(url, auth)
.and_raise(Gitlab::Git::Repository::NoRepository)
end
expect { repository.update_root_ref(url, auth) }.not_to raise_error
it 'logs a message' do
expect(Gitlab::AppLogger)
.to receive(:info)
.with(/Error updating root ref for repository/)
repository.update_root_ref(url, auth)
end
it 'returns nil when NoRepository exception is raised' do
expect(repository.update_root_ref(url, auth)).to be_nil
end
it 'does not raise error' do
expect { repository.update_root_ref(url, auth) }.not_to raise_error
end
end
def stub_find_remote_root_ref(repository, ref:)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment