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
bba2aa0c
Commit
bba2aa0c
authored
Jul 09, 2019
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show the node health status summary for unhealthy nodes
parent
48a4bef1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
11 deletions
+58
-11
ee/lib/tasks/geo.rake
ee/lib/tasks/geo.rake
+5
-0
ee/spec/factories/geo_node_statuses.rb
ee/spec/factories/geo_node_statuses.rb
+1
-0
ee/spec/tasks/geo_rake_spec.rb
ee/spec/tasks/geo_rake_spec.rb
+52
-11
No files found.
ee/lib/tasks/geo.rake
View file @
bba2aa0c
...
...
@@ -248,6 +248,11 @@ namespace :geo do
puts
current_node_status
.
health_status
.
color
(
:red
)
end
unless
current_node_status
.
healthy?
print
'Health Status Summary: '
.
rjust
(
GEO_STATUS_COLUMN_WIDTH
)
puts
current_node_status
.
health
.
color
(
:red
)
end
print
'Repositories: '
.
rjust
(
GEO_STATUS_COLUMN_WIDTH
)
show_failed_value
(
current_node_status
.
repositories_failed_count
)
print
"
#{
current_node_status
.
repositories_synced_count
}
/
#{
current_node_status
.
projects_count
}
"
...
...
ee/spec/factories/geo_node_statuses.rb
View file @
bba2aa0c
...
...
@@ -34,6 +34,7 @@ FactoryBot.define do
wikis_checksum_mismatch_count
10
repositories_retrying_verification_count
25
wikis_retrying_verification_count
3
repositories_checked_failed_count
1
last_event_id
2
last_event_timestamp
{
Time
.
now
.
to_i
}
cursor_last_event_id
1
...
...
ee/spec/tasks/geo_rake_spec.rb
View file @
bba2aa0c
...
...
@@ -62,19 +62,60 @@ describe 'geo rake tasks', :geo do
end
describe
'status task'
,
:geo_fdw
do
let!
(
:current_node
)
{
create
(
:geo_node
)
}
let!
(
:primary_node
)
{
create
(
:geo_node
,
:primary
)
}
let!
(
:geo_event_log
)
{
create
(
:geo_event_log
)
}
before
do
expect
(
Gitlab
::
Geo
).
to
receive
(
:license_allows?
).
and_return
(
true
).
at_least
(
:once
)
expect
(
GeoNodeStatus
).
to
receive
(
:current_node_status
).
and_call_original
stub_current_geo_node
(
current_node
)
context
'without a valid license'
do
before
do
stub_licensed_features
(
geo:
false
)
end
it
'runs with an error'
do
expect
{
run_rake_task
(
'geo:status'
)
}.
to
raise_error
(
"GitLab Geo is not supported with this license. Please contact the sales team: https://about.gitlab.com/sales."
)
end
end
it
'runs with no error'
do
expect
{
run_rake_task
(
'geo:status'
)
}.
to
output
(
/Sync Settings: Full/
).
to_stdout
context
'with a valid license'
do
let!
(
:current_node
)
{
create
(
:geo_node
)
}
let!
(
:primary_node
)
{
create
(
:geo_node
,
:primary
)
}
let!
(
:geo_event_log
)
{
create
(
:geo_event_log
)
}
let!
(
:geo_node_status
)
{
build
(
:geo_node_status
,
:healthy
,
geo_node:
current_node
)
}
before
do
stub_licensed_features
(
geo:
true
)
stub_current_geo_node
(
current_node
)
allow
(
GeoNodeStatus
).
to
receive
(
:current_node_status
).
once
.
and_return
(
geo_node_status
)
end
it
'runs with no error'
do
expect
{
run_rake_task
(
'geo:status'
)
}.
not_to
raise_error
end
context
'with a healthy node'
do
before
do
geo_node_status
.
status_message
=
nil
end
it
'shows status as healthy'
do
expect
{
run_rake_task
(
'geo:status'
)
}.
to
output
(
/Health Status: Healthy/
).
to_stdout
end
it
'does not show health status summary'
do
expect
{
run_rake_task
(
'geo:status'
)
}.
not_to
output
(
/Health Status Summary/
).
to_stdout
end
end
context
'with an unhealthy node'
do
before
do
geo_node_status
.
status_message
=
'Something went wrong'
end
it
'shows status as unhealthy'
do
expect
{
run_rake_task
(
'geo:status'
)
}.
to
output
(
/Health Status: Unhealthy/
).
to_stdout
end
it
'shows health status summary'
do
expect
{
run_rake_task
(
'geo:status'
)
}.
to
output
(
/Health Status Summary: Something went wrong/
).
to_stdout
end
end
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