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
256b12da
Commit
256b12da
authored
Dec 06, 2017
by
Douglas Barbosa Alexandre
Committed by
Kushal Pandya
Dec 08, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose GitLab version in Geo status API
parent
3ed8b2ee
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
3 deletions
+11
-3
app/models/geo_node_status.rb
app/models/geo_node_status.rb
+1
-1
app/serializers/geo_node_status_entity.rb
app/serializers/geo_node_status_entity.rb
+2
-0
spec/factories/geo_node_statuses.rb
spec/factories/geo_node_statuses.rb
+1
-0
spec/fixtures/api/schemas/geo_node_status.json
spec/fixtures/api/schemas/geo_node_status.json
+4
-2
spec/requests/api/geo_nodes_spec.rb
spec/requests/api/geo_nodes_spec.rb
+3
-0
No files found.
app/models/geo_node_status.rb
View file @
256b12da
...
...
@@ -27,7 +27,6 @@ class GeoNodeStatus < ActiveRecord::Base
def
self
.
current_node_status
current_node
=
Gitlab
::
Geo
.
current_node
return
unless
current_node
status
=
current_node
.
find_or_build_status
...
...
@@ -68,6 +67,7 @@ class GeoNodeStatus < ActiveRecord::Base
self
.
lfs_objects_count
=
geo_node
.
lfs_objects
.
count
self
.
attachments_count
=
geo_node
.
uploads
.
count
self
.
last_successful_status_check_at
=
Time
.
now
self
.
version
=
Gitlab
::
VERSION
if
Gitlab
::
Geo
.
secondary?
self
.
db_replication_lag_seconds
=
Gitlab
::
Geo
::
HealthCheck
.
db_replication_lag_seconds
...
...
app/serializers/geo_node_status_entity.rb
View file @
256b12da
...
...
@@ -39,6 +39,8 @@ class GeoNodeStatusEntity < Grape::Entity
expose
:last_successful_status_check_timestamp
expose
:version
expose
:namespaces
,
using:
NamespaceEntity
def
namespaces
...
...
spec/factories/geo_node_statuses.rb
View file @
256b12da
...
...
@@ -2,6 +2,7 @@ FactoryGirl.define do
factory
:geo_node_status
do
sequence
(
:id
)
geo_node
version
{
Gitlab
::
VERSION
}
trait
:healthy
do
health
nil
...
...
spec/fixtures/api/schemas/geo_node_status.json
View file @
256b12da
...
...
@@ -19,7 +19,8 @@
"last_event_timestamp"
,
"cursor_last_event_id"
,
"cursor_last_event_timestamp"
,
"namespaces"
"namespaces"
,
"version"
],
"properties"
:
{
"geo_node_id"
:
{
"type"
:
"integer"
},
...
...
@@ -44,7 +45,8 @@
"cursor_last_event_id"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"cursor_last_event_timestamp"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"last_successful_status_check_timestamp"
:
{
"type"
:
[
"integer"
,
"null"
]
},
"namespaces"
:
{
"type"
:
"array"
}
"namespaces"
:
{
"type"
:
"array"
},
"version"
:
{
"type"
:
[
"string"
]
}
},
"additionalProperties"
:
false
}
spec/requests/api/geo_nodes_spec.rb
View file @
256b12da
...
...
@@ -62,7 +62,9 @@ describe API::GeoNodes, :geo, api: true do
describe
'GET /geo_nodes/:id/status'
do
it
'retrieves the Geo nodes status if admin is logged in'
do
stub_current_geo_node
(
primary
)
expect
(
GeoNodeStatus
).
not_to
receive
(
:current_node_status
)
get
api
(
"/geo_nodes/
#{
secondary
.
id
}
/status"
,
admin
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
...
...
@@ -71,6 +73,7 @@ describe API::GeoNodes, :geo, api: true do
it
'fetches the current node status'
do
stub_current_geo_node
(
secondary
)
expect
(
GeoNode
).
to
receive
(
:find
).
and_return
(
secondary
)
expect
(
GeoNodeStatus
).
to
receive
(
:current_node_status
).
and_call_original
...
...
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