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
76690d5c
Commit
76690d5c
authored
May 25, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a check for secondary role setting to Geo health check status
parent
2df37bf2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
13 deletions
+8
-13
lib/api/geo.rb
lib/api/geo.rb
+0
-5
lib/gitlab/geo/health_check.rb
lib/gitlab/geo/health_check.rb
+1
-0
spec/lib/gitlab/geo/health_check_spec.rb
spec/lib/gitlab/geo/health_check_spec.rb
+7
-0
spec/requests/api/geo_spec.rb
spec/requests/api/geo_spec.rb
+0
-8
No files found.
lib/api/geo.rb
View file @
76690d5c
...
...
@@ -35,7 +35,6 @@ module API
get
'status'
do
authenticate_by_gitlab_geo_node_token!
require_node_to_be_secondary!
require_node_to_have_tracking_db!
present
GeoNodeStatus
.
new
(
id:
Gitlab
::
Geo
.
current_node
.
id
),
with:
Entities
::
GeoNodeStatus
end
...
...
@@ -110,10 +109,6 @@ module API
def
require_node_to_be_secondary!
forbidden!
'Geo node is not secondary node.'
unless
Gitlab
::
Geo
.
current_node
&
.
secondary?
end
def
require_node_to_have_tracking_db!
not_found!
'Geo node does not have its tracking database enabled.'
unless
Gitlab
::
Geo
.
secondary_role_enabled?
end
end
end
end
lib/gitlab/geo/health_check.rb
View file @
76690d5c
...
...
@@ -3,6 +3,7 @@ module Gitlab
class
HealthCheck
def
self
.
perform_checks
return
''
unless
Gitlab
::
Geo
.
secondary?
return
'The Geo secondary role is disabled.'
unless
Gitlab
::
Geo
.
secondary_role_enabled?
return
'The Geo database configuration file is missing.'
unless
self
.
geo_database_configured?
return
'The Geo node has a database that is not configured for streaming replication with the primary node.'
unless
self
.
database_secondary?
...
...
spec/lib/gitlab/geo/health_check_spec.rb
View file @
76690d5c
...
...
@@ -16,6 +16,13 @@ describe Gitlab::Geo::HealthCheck do
expect
(
subject
.
perform_checks
).
to
be_blank
end
it
'returns an error when secondary role is disabled'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
true
}
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary_role_enabled?
).
and_return
(
false
)
expect
(
subject
.
perform_checks
).
not_to
be_blank
end
it
'returns an error when database is not configured for streaming replication'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
true
}
allow
(
Gitlab
::
Database
).
to
receive
(
:postgresql?
)
{
true
}
...
...
spec/requests/api/geo_spec.rb
View file @
76690d5c
...
...
@@ -307,14 +307,6 @@ describe API::Geo, api: true do
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
match_response_schema
(
'geo_node_status'
)
end
it
'responds with a 404 when the secondary role is disabled'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary_role_enabled?
).
and_return
(
false
)
get
api
(
'/geo/status'
),
nil
,
request
.
headers
expect
(
response
).
to
have_http_status
(
404
)
end
end
context
'when requesting primary node with valid auth header'
do
...
...
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