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
1122d463
Commit
1122d463
authored
Aug 27, 2019
by
Reuben Pereira
Committed by
Lin Jen-Shin
Aug 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add nil check for Gitlab.config.prometheus
parent
530115f9
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 @
1122d463
...
...
@@ -173,7 +173,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'
))
...
...
@@ -181,7 +181,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 @
1122d463
...
...
@@ -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