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
6a67148e
Commit
6a67148e
authored
7 years ago
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make production settings fixture use Gitlab::CurrentSettings.current_application_settings
small code formatting changes
parent
c86e1437
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
24 deletions
+17
-24
db/fixtures/production/010_settings.rb
db/fixtures/production/010_settings.rb
+10
-13
spec/db/production/settings_spec.rb
spec/db/production/settings_spec.rb
+2
-2
spec/lib/gitlab/health_checks/prometheus_text_format_spec.rb
spec/lib/gitlab/health_checks/prometheus_text_format_spec.rb
+5
-9
No files found.
db/fixtures/production/010_settings.rb
View file @
6a67148e
...
...
@@ -12,18 +12,15 @@ def save(settings, topic)
end
end
envs
=
%w{ GITLAB_PROMETHEUS_METRICS_ENABLED GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN }
if
envs
.
any?
{
|
env_name
|
ENV
[
env_name
].
present?
}
settings
=
ApplicationSetting
.
current
||
ApplicationSetting
.
create_from_defaults
if
ENV
[
'GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN'
].
present?
if
ENV
[
'GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN'
].
present?
settings
=
Gitlab
::
CurrentSettings
.
current_application_settings
settings
.
set_runners_registration_token
(
ENV
[
'GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN'
])
save
(
settings
,
'Runner Registration Token'
)
end
end
if
ENV
[
'GITLAB_PROMETHEUS_METRICS_ENABLED'
].
present?
if
ENV
[
'GITLAB_PROMETHEUS_METRICS_ENABLED'
].
present?
settings
=
Gitlab
::
CurrentSettings
.
current_application_settings
value
=
Gitlab
::
Utils
.
to_boolean
(
ENV
[
'GITLAB_PROMETHEUS_METRICS_ENABLED'
])
settings
.
prometheus_metrics_enabled
=
value
save
(
settings
,
'Prometheus metrics enabled flag'
)
end
end
This diff is collapsed.
Click to expand it.
spec/db/production/settings_spec.rb
View file @
6a67148e
...
...
@@ -3,8 +3,8 @@ require 'rainbow/ext/string'
describe
'seed production settings'
,
lib:
true
do
include
StubENV
let
(
:settings_file
)
{
File
.
join
(
__dir__
,
'../../../
db/fixtures/production/010_settings.rb'
)
}
let
(
:settings
)
{
ApplicationSetting
.
current
||
ApplicationSetting
.
create_from_default
s
}
let
(
:settings_file
)
{
Rails
.
root
.
join
(
'
db/fixtures/production/010_settings.rb'
)
}
let
(
:settings
)
{
Gitlab
::
CurrentSettings
.
current_application_setting
s
}
context
'GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN is set in the environment'
do
before
do
...
...
This diff is collapsed.
Click to expand it.
spec/lib/gitlab/health_checks/prometheus_text_format_spec.rb
View file @
6a67148e
...
...
@@ -4,10 +4,8 @@ describe Gitlab::HealthChecks::PrometheusTextFormat do
describe
'#marshal'
do
let
(
:sample_metrics
)
do
[
metric_class
.
new
(
'metric1'
,
1
),
metric_class
.
new
(
'metric2'
,
2
)
]
[
metric_class
.
new
(
'metric1'
,
1
),
metric_class
.
new
(
'metric2'
,
2
)]
end
it
'marshal to text with non repeating type definition'
do
...
...
@@ -23,11 +21,9 @@ describe Gitlab::HealthChecks::PrometheusTextFormat do
context
'metrics where name repeats'
do
let
(
:sample_metrics
)
do
[
metric_class
.
new
(
'metric1'
,
1
),
[
metric_class
.
new
(
'metric1'
,
1
),
metric_class
.
new
(
'metric1'
,
2
),
metric_class
.
new
(
'metric2'
,
3
)
]
metric_class
.
new
(
'metric2'
,
3
)]
end
it
'marshal to text with non repeating type definition'
do
...
...
This diff is collapsed.
Click to expand it.
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