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
387c844e
Commit
387c844e
authored
May 07, 2018
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move specs to the right place and fix failed ones
parent
c2691419
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
5 deletions
+19
-5
ee/app/services/geo/project_housekeeping_service.rb
ee/app/services/geo/project_housekeeping_service.rb
+2
-2
ee/spec/services/geo/project_housekeeping_service_spec.rb
ee/spec/services/geo/project_housekeeping_service_spec.rb
+2
-2
ee/spec/services/geo/repository_sync_service_spec.rb
ee/spec/services/geo/repository_sync_service_spec.rb
+15
-1
No files found.
ee/app/services/geo/project_housekeeping_service.rb
View file @
387c844e
...
...
@@ -27,14 +27,14 @@ module Geo
@registry
||=
Geo
::
ProjectRegistry
.
find_or_initialize_by
(
project_id:
project
.
id
)
end
private
def
increment!
Gitlab
::
Metrics
.
measure
(
:geo_increment_syncs_since_gc
)
do
registry
.
increment_syncs_since_gc
end
end
private
def
do_housekeeping
lease_uuid
=
try_obtain_lease
return
false
unless
lease_uuid
.
present?
...
...
ee/spec/services/geo/project_housekeeping_service_spec.rb
View file @
387c844e
...
...
@@ -33,7 +33,7 @@ describe Geo::ProjectHousekeepingService do
it
'resets counter when syncs_since_gc > gc_period'
do
allow
(
service
).
to
receive
(
:gc_period
).
and_return
(
1
)
allow
(
service
).
to
receive
(
:try_obtain_lease
).
and_return
(
:the_uuid
)
registry
.
increment_syncs_since_gc
service
.
increment!
Sidekiq
::
Testing
.
inline!
do
expect
{
service
.
execute
}.
to
change
{
registry
.
syncs_since_gc
}.
to
(
0
)
...
...
@@ -109,7 +109,7 @@ describe Geo::ProjectHousekeepingService do
describe
'#increment!'
do
it
'increments the syncs_since_gc counter'
do
expect
{
service
.
send
(
:increment!
)
}.
to
change
{
registry
.
syncs_since_gc
}.
by
(
1
)
expect
{
service
.
increment!
}.
to
change
{
registry
.
syncs_since_gc
}.
by
(
1
)
end
end
...
...
ee/spec/services/geo/repository_sync_service_spec.rb
View file @
387c844e
...
...
@@ -7,7 +7,7 @@ describe Geo::RepositorySyncService do
set
(
:secondary
)
{
create
(
:geo_node
)
}
let
(
:lease
)
{
double
(
try_obtain:
true
)
}
l
et
(
:project
)
{
create
(
:project_empty_repo
)
}
s
et
(
:project
)
{
create
(
:project_empty_repo
)
}
let
(
:repository
)
{
project
.
repository
}
subject
{
described_class
.
new
(
project
)
}
...
...
@@ -354,4 +354,18 @@ describe Geo::RepositorySyncService do
end
end
end
context
'repository housekeeping'
do
let
(
:registry
)
{
Geo
::
ProjectRegistry
.
find_or_initialize_by
(
project_id:
project
.
id
)
}
it
'increases sync count after execution'
do
expect
{
subject
.
execute
}.
to
change
{
registry
.
syncs_since_gc
}.
by
(
1
)
end
it
'initiate housekeeping at end of execution'
do
expect_any_instance_of
(
Geo
::
ProjectHousekeepingService
).
to
receive
(
:execute
)
subject
.
execute
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