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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
b99cf202
Commit
b99cf202
authored
Aug 26, 2019
by
rpereira2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add nil check for Gitlab.config.prometheus
parent
8112fb37
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
lib/gitlab/database_importers/self_monitoring/project/create_service.rb
...abase_importers/self_monitoring/project/create_service.rb
+2
-2
spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb
..._importers/self_monitoring/project/create_service_spec.rb
+11
-0
No files found.
lib/gitlab/database_importers/self_monitoring/project/create_service.rb
View file @
b99cf202
...
...
@@ -175,7 +175,7 @@ module Gitlab
end
def
prometheus_enabled?
Gitlab
.
config
.
prometheus
.
enable
Gitlab
.
config
.
prometheus
.
enable
if
Gitlab
.
config
.
prometheus
rescue
Settingslogic
::
MissingSetting
log_error
(
_
(
'prometheus.enable is not present in gitlab.yml'
))
...
...
@@ -183,7 +183,7 @@ module Gitlab
end
def
prometheus_listen_address
Gitlab
.
config
.
prometheus
.
listen_address
Gitlab
.
config
.
prometheus
.
listen_address
if
Gitlab
.
config
.
prometheus
rescue
Settingslogic
::
MissingSetting
log_error
(
_
(
'prometheus.listen_address is not present in gitlab.yml'
))
...
...
spec/lib/gitlab/database_importers/self_monitoring/project/create_service_spec.rb
View file @
b99cf202
...
...
@@ -197,6 +197,17 @@ describe Gitlab::DatabaseImporters::SelfMonitoring::Project::CreateService do
end
end
context
'when prometheus setting is nil'
do
before
do
stub_config
(
prometheus:
nil
)
end
it
'does not fail'
do
expect
(
result
).
to
include
(
status: :success
)
expect
(
project
.
prometheus_service
).
to
be_nil
end
end
context
'when prometheus setting is disabled in gitlab.yml'
do
let
(
:prometheus_settings
)
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