Skip to content
代码片段 群组 项目
未验证 提交 12379b8f 编辑于 作者: Dmitry Gruzd's avatar Dmitry Gruzd 提交者: GitLab
浏览文件

Merge branch 'ag-decrease-log-level' into 'master'

Decrease log level of false error when project repo is missing during replication

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/178184



Merged-by: default avatarDmitry Gruzd <dgruzd@gitlab.com>
Approved-by: default avatarScott Murray <smurray@gitlab.com>
Approved-by: default avatarDouglas Barbosa Alexandre <dbalexandre@gmail.com>
Reviewed-by: default avatarScott Murray <smurray@gitlab.com>
Co-authored-by: default avatarAakriti Gupta <agupta@gitlab.com>
No related branches found
No related tags found
无相关合并请求
......@@ -131,7 +131,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
......
......@@ -370,12 +370,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% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册