Commit bd54136e authored by Stan Hu's avatar Stan Hu

Merge branch '5751-geo-undefined-method-pending_delete-for-nil-nilclass' into 'master'

Resolve "Geo: undefined method `pending_delete?' for nil:NilClass in geo/repository_verification/secondary/single_worker.rb"

Closes #5751

See merge request gitlab-org/gitlab-ee!5470
parents 1a4b6568 1378380b
...@@ -18,7 +18,7 @@ module Geo ...@@ -18,7 +18,7 @@ module Geo
return unless Gitlab::Geo.secondary? return unless Gitlab::Geo.secondary?
@registry = Geo::ProjectRegistry.find_by_id(registry_id) @registry = Geo::ProjectRegistry.find_by_id(registry_id)
return if registry.nil? || project.pending_delete? return if registry.nil? || project.nil? || project.pending_delete?
try_obtain_lease do try_obtain_lease do
verify_checksum(:repository) verify_checksum(:repository)
......
---
title: Geo - Fix undefined method pending_delete for nil class
merge_request: 5470
author:
type: fixed
...@@ -36,6 +36,12 @@ describe Geo::RepositoryVerification::Secondary::SingleWorker, :postgresql, :cle ...@@ -36,6 +36,12 @@ describe Geo::RepositoryVerification::Secondary::SingleWorker, :postgresql, :cle
expect { subject.perform(-1) }.not_to raise_error expect { subject.perform(-1) }.not_to raise_error
end end
it 'does not raise an error when project could not be found' do
registry.update_column(:project_id, -1)
expect { subject.perform(registry.id) }.not_to raise_error
end
it 'runs verification for both repository and wiki' do it 'runs verification for both repository and wiki' do
create(:repository_state, project: project, repository_verification_checksum: 'my_checksum', wiki_verification_checksum: 'my_checksum') create(:repository_state, project: project, repository_verification_checksum: 'my_checksum', wiki_verification_checksum: 'my_checksum')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment