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
b08831c4
Commit
b08831c4
authored
May 19, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add more details to Geo health check status message
parent
65effeb2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
1 deletion
+54
-1
app/assets/stylesheets/pages/geo_nodes.scss
app/assets/stylesheets/pages/geo_nodes.scss
+1
-0
app/services/geo/node_status_service.rb
app/services/geo/node_status_service.rb
+10
-1
spec/services/geo/node_status_service_spec.rb
spec/services/geo/node_status_service_spec.rb
+43
-0
No files found.
app/assets/stylesheets/pages/geo_nodes.scss
View file @
b08831c4
...
...
@@ -32,6 +32,7 @@
.geo-health
{
display
:
inline-block
;
margin-top
:
5px
;
white-space
:
pre-wrap
;
}
.node-badge
{
...
...
app/services/geo/node_status_service.rb
View file @
b08831c4
...
...
@@ -22,7 +22,16 @@ module Geo
if
response
.
success?
response
.
parsed_response
.
values_at
(
*
KEYS
)
else
[
"Could not connect to Geo node - HTTP Status Code:
#{
response
.
code
}
"
]
message
=
"Could not connect to Geo node - HTTP Status Code:
#{
response
.
code
}
#{
response
.
message
}
"
payload
=
response
.
parsed_response
details
=
if
payload
.
is_a?
(
Hash
)
payload
[
'message'
]
else
payload
end
Array
([
message
,
details
].
compact
.
join
(
"
\n
"
))
end
rescue
HTTParty
::
Error
,
Timeout
::
Error
,
SocketError
,
Errno
::
ECONNRESET
,
Errno
::
ECONNREFUSED
=>
e
[
e
.
message
]
...
...
spec/services/geo/node_status_service_spec.rb
0 → 100644
View file @
b08831c4
require
'spec_helper'
describe
Geo
::
NodeStatusService
,
services:
true
do
let!
(
:primary
)
{
create
(
:geo_node
,
:primary
)
}
let
(
:secondary
)
{
create
(
:geo_node
)
}
subject
{
described_class
.
new
}
before
do
allow
(
described_class
).
to
receive
(
:current_node
)
{
primary
}
end
describe
'#call'
do
it
'parses a 401 response'
do
request
=
double
(
success?:
false
,
code:
401
,
message:
'Unauthorized'
,
parsed_response:
{
'message'
=>
'Test'
}
)
allow
(
described_class
).
to
receive
(
:get
).
and_return
(
request
)
status
=
subject
.
call
(
secondary
)
expect
(
status
.
health
).
to
eq
(
"Could not connect to Geo node - HTTP Status Code: 401 Unauthorized
\n
Test"
)
end
it
'parses a 200 response'
do
data
=
{
health:
'OK'
,
repositories_count:
10
,
repositories_synced_count:
1
,
repositories_failed_count:
2
,
lfs_objects_count:
100
,
lfs_objects_synced_count:
50
,
attachments_count:
30
,
attachments_synced_count:
30
}
request
=
double
(
success?:
true
,
parsed_response:
data
.
stringify_keys
,
code:
200
)
allow
(
described_class
).
to
receive
(
:get
).
and_return
(
request
)
status
=
subject
.
call
(
secondary
)
expect
(
status
).
to
have_attributes
(
data
)
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