Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d4f3f0ef
Commit
d4f3f0ef
authored
Jun 29, 2018
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename repository verification service on secondary node
parent
8f105380
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
12 deletions
+33
-12
ee/app/services/geo/repository_verification_secondary_service.rb
...services/geo/repository_verification_secondary_service.rb
+1
-1
ee/app/workers/geo/repository_verification/secondary/single_worker.rb
...rs/geo/repository_verification/secondary/single_worker.rb
+2
-2
ee/spec/services/geo/repository_verification_secondary_service_spec.rb
...ces/geo/repository_verification_secondary_service_spec.rb
+1
-1
ee/spec/workers/geo/repository_verification/secondary/single_worker_spec.rb
...o/repository_verification/secondary/single_worker_spec.rb
+29
-8
No files found.
ee/app/services/geo/repository_verif
y
_secondary_service.rb
→
ee/app/services/geo/repository_verif
ication
_secondary_service.rb
View file @
d4f3f0ef
module
Geo
class
RepositoryVerif
y
SecondaryService
class
RepositoryVerif
ication
SecondaryService
include
Gitlab
::
Geo
::
ProjectLogHelpers
def
initialize
(
registry
,
type
)
...
...
ee/app/workers/geo/repository_verification/secondary/single_worker.rb
View file @
d4f3f0ef
...
...
@@ -17,7 +17,7 @@ module Geo
def
perform
(
registry_id
)
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
.
nil?
||
project
.
pending_delete?
try_obtain_lease
do
...
...
@@ -29,7 +29,7 @@ module Geo
private
def
verify_checksum
(
type
)
Geo
::
RepositoryVerif
y
SecondaryService
.
new
(
registry
,
type
).
execute
Geo
::
RepositoryVerif
ication
SecondaryService
.
new
(
registry
,
type
).
execute
rescue
=>
e
log_error
(
'Error verifying the repository checksum'
,
e
,
type:
type
)
raise
e
...
...
ee/spec/services/geo/repository_verif
y
_secondary_service_spec.rb
→
ee/spec/services/geo/repository_verif
ication
_secondary_service_spec.rb
View file @
d4f3f0ef
require
'spec_helper'
describe
Geo
::
RepositoryVerif
y
SecondaryService
,
:geo
do
describe
Geo
::
RepositoryVerif
ication
SecondaryService
,
:geo
do
include
::
EE
::
GeoHelpers
let
(
:secondary
)
{
create
(
:geo_node
)
}
...
...
ee/spec/workers/geo/repository_verification/secondary/single_worker_spec.rb
View file @
d4f3f0ef
...
...
@@ -10,24 +10,33 @@ describe Geo::RepositoryVerification::Secondary::SingleWorker, :postgresql, :cle
before
do
stub_current_geo_node
(
secondary
)
stub_exclusive_lease
end
describe
'#perform'
do
it
'does not calculate the checksum when not running on a secondary'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
false
}
expect_any_instance_of
(
Geo
::
RepositoryVerifySecondaryService
).
not_to
receive
(
:execute
)
subject
.
perform
(
registry
.
id
)
expect
(
registry
.
reload
).
to
have_attributes
(
repository_verification_checksum_sha:
nil
,
last_repository_verification_failure:
nil
,
wiki_verification_checksum_sha:
nil
,
last_wiki_verification_failure:
nil
)
end
it
'does not calculate the checksum when project is pending deletion'
do
registry
.
project
.
update!
(
pending_delete:
true
)
expect_any_instance_of
(
Geo
::
RepositoryVerifySecondaryService
).
not_to
receive
(
:execute
)
subject
.
perform
(
registry
.
id
)
expect
(
registry
.
reload
).
to
have_attributes
(
repository_verification_checksum_sha:
nil
,
last_repository_verification_failure:
nil
,
wiki_verification_checksum_sha:
nil
,
last_wiki_verification_failure:
nil
)
end
it
'does not raise an error when registry could not be found'
do
...
...
@@ -41,12 +50,24 @@ describe Geo::RepositoryVerification::Secondary::SingleWorker, :postgresql, :cle
end
it
'runs verification for both repository and wiki'
do
create
(
:repository_state
,
project:
project
,
repository_verification_checksum:
'my_checksum'
,
wiki_verification_checksum:
'my_checksum'
)
stub_exclusive_lease
expect
(
Geo
::
RepositoryVerifySecondaryService
).
to
receive
(
:new
).
with
(
registry
,
:repository
).
and_call_original
expect
(
Geo
::
RepositoryVerifySecondaryService
).
to
receive
(
:new
).
with
(
registry
,
:wiki
).
and_call_original
service
=
instance_double
(
Geo
::
RepositoryVerificationSecondaryService
,
execute:
true
)
allow
(
Geo
::
RepositoryVerificationSecondaryService
)
.
to
receive
(
:new
)
.
with
(
registry
,
:repository
)
.
and_return
(
service
)
allow
(
Geo
::
RepositoryVerificationSecondaryService
)
.
to
receive
(
:new
)
.
with
(
registry
,
:wiki
)
.
and_return
(
service
)
subject
.
perform
(
registry
.
id
)
expect
(
service
).
to
have_received
(
:execute
).
twice
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment