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
b982d4b1
Commit
b982d4b1
authored
Jan 28, 2021
by
Terri Chu
Committed by
Kamil Trzciński
Jan 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle unreachable ES host in settings check
parent
3cae40d9
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
1 deletion
+37
-1
ee/app/views/admin/application_settings/_elasticsearch_form.html.haml
.../admin/application_settings/_elasticsearch_form.html.haml
+1
-1
ee/changelogs/unreleased/299991-opening-admin-settings-page-results-in-the-error-500-if-localho.yml
...min-settings-page-results-in-the-error-500-if-localho.yml
+5
-0
ee/lib/gitlab/elastic/helper.rb
ee/lib/gitlab/elastic/helper.rb
+7
-0
ee/spec/lib/ee/gitlab/elastic/helper_spec.rb
ee/spec/lib/ee/gitlab/elastic/helper_spec.rb
+11
-0
ee/spec/views/admin/application_settings/_elasticsearch_form.html.haml_spec.rb
...pplication_settings/_elasticsearch_form.html.haml_spec.rb
+13
-0
No files found.
ee/app/views/admin/application_settings/_elasticsearch_form.html.haml
View file @
b982d4b1
...
...
@@ -3,7 +3,7 @@
-
recreate_index_url
=
help_page_url
(
'integration/elasticsearch.md'
)
-
recreate_index_link_start
=
'<a href="%{url}" target="_blank" rel="noopener noreferrer">'
.
html_safe
%
{
url:
recreate_index_url
}
-
recreate_index_text
=
_
(
"Changes won't take place until the index is %{link_start}recreated%{link_end}."
).
html_safe
%
{
link_start:
recreate_index_link_start
,
link_end:
'</a>'
.
html_safe
}
-
elasticsearch_available
=
Gitlab
::
Elastic
::
Helper
.
default
.
client
.
ping
-
elasticsearch_available
=
Gitlab
::
Elastic
::
Helper
.
default
.
ping?
%section
.settings.expanded.as-elasticsearch.no-animate
#js-elasticsearch-settings
{
data:
{
qa_selector:
'elasticsearch_tab'
}
}
.settings-header
...
...
ee/changelogs/unreleased/299991-opening-admin-settings-page-results-in-the-error-500-if-localho.yml
0 → 100644
View file @
b982d4b1
---
title
:
Handle network unreachable for ES settings check
merge_request
:
52586
author
:
type
:
fixed
ee/lib/gitlab/elastic/helper.rb
View file @
b982d4b1
...
...
@@ -294,6 +294,13 @@ module Gitlab
end
end
# handles unreachable hosts and any other exceptions that may be raised
def
ping?
client
.
ping
rescue
false
end
private
def
additional_index_options
...
...
ee/spec/lib/ee/gitlab/elastic/helper_spec.rb
View file @
b982d4b1
...
...
@@ -359,4 +359,15 @@ RSpec.describe Gitlab::Elastic::Helper do
end
end
end
describe
'#ping?'
do
subject
{
helper
.
ping?
}
it
'does not raise any exception'
do
allow
(
Gitlab
::
Elastic
::
Helper
.
default
.
client
).
to
receive
(
:ping
).
and_raise
(
StandardError
)
expect
(
subject
).
to
be_falsey
expect
{
subject
}.
not_to
raise_exception
end
end
end
ee/spec/views/admin/application_settings/_elasticsearch_form.html.haml_spec.rb
View file @
b982d4b1
...
...
@@ -218,5 +218,18 @@ RSpec.describe 'admin/application_settings/_elasticsearch_form' do
expect
(
rendered
).
to
include
(
'Retry migration'
)
end
end
context
'when elasticsearch is unreachable'
do
before
do
allow
(
Gitlab
::
Elastic
::
Helper
.
default
).
to
receive
(
:ping?
).
and_return
(
false
)
end
it
'does not show the retry migration card'
do
render
expect
(
rendered
).
not_to
include
(
'There is a halted Elasticsearch migration'
)
expect
(
rendered
).
not_to
include
(
'Retry migration'
)
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