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
62534363
Commit
62534363
authored
Jul 12, 2017
by
Gabriel Mazetto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Raise error when clone_url_prefix is nil and add specs
parent
4ed9c9f9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
app/services/geo/base_sync_service.rb
app/services/geo/base_sync_service.rb
+7
-1
spec/services/geo/base_sync_service_spec.rb
spec/services/geo/base_sync_service_spec.rb
+21
-0
No files found.
app/services/geo/base_sync_service.rb
View file @
62534363
module
Geo
# The clone_url_prefix is used to build URLs for the Geo synchronization
# If this is missing from the primary node we raise this exception
EmptyCloneUrlPrefixError
=
Class
.
new
(
StandardError
)
class
BaseSyncService
class
<<
self
attr_accessor
:type
...
...
@@ -71,7 +75,9 @@ module Geo
end
def
primary_ssh_path_prefix
@primary_ssh_path_prefix
||=
Gitlab
::
Geo
.
primary_node
.
clone_url_prefix
@primary_ssh_path_prefix
||=
Gitlab
::
Geo
.
primary_node
.
clone_url_prefix
.
tap
do
|
prefix
|
raise
EmptyCloneUrlPrefixError
,
'Missing clone_url_prefix in the primary node'
unless
prefix
.
present?
end
end
def
log
(
message
)
...
...
spec/services/geo/base_sync_service_spec.rb
0 → 100644
View file @
62534363
require
'spec_helper'
describe
Geo
::
BaseSyncService
,
services:
true
do
let
(
:project
)
{
double
(
'project'
)}
subject
{
described_class
.
new
(
project
)
}
describe
'#primary_ssh_path_prefix'
do
let!
(
:primary_node
)
{
create
(
:geo_node
,
:primary
,
host:
'primary-geo-node'
)
}
it
'raises exception when clone_url_prefix is nil'
do
allow_any_instance_of
(
GeoNode
).
to
receive
(
:clone_url_prefix
)
{
nil
}
expect
{
subject
.
send
(
:primary_ssh_path_prefix
)
}.
to
raise_error
Geo
::
EmptyCloneUrlPrefixError
end
it
'returns the prefix defined in the primary node'
do
expect
{
subject
.
send
(
:primary_ssh_path_prefix
)
}.
not_to
raise_error
expect
(
subject
.
send
(
:primary_ssh_path_prefix
)).
to
eq
(
'git@localhost:'
)
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