summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Chojnacki <pawel@chojnacki.ws>2017-06-02 15:55:44 +0200
committerPawel Chojnacki <pawel@chojnacki.ws>2017-06-02 19:48:39 +0200
commitd26573c6e3de535f69437deaf54d5c151ac343c8 (patch)
tree7a136066f4c5b9ac54593e2445a89d78651a236b
parent6a67148ed3543ee5073ab49dc4e825f3d87cc8b5 (diff)
downloadgitlab-ce-d26573c6e3de535f69437deaf54d5c151ac343c8.tar.gz
Make PrometheusTextFormat return proper output terminated with '\n'
remove file dangling after rebase
-rw-r--r--app/services/metrics_service.rb2
-rw-r--r--lib/gitlab/health_checks/prometheus_text_format.rb2
-rw-r--r--spec/db/production/settings.rb16
-rw-r--r--spec/lib/gitlab/health_checks/prometheus_text_format_spec.rb4
4 files changed, 4 insertions, 20 deletions
diff --git a/app/services/metrics_service.rb b/app/services/metrics_service.rb
index 2a001dc5108..d726db4e99b 100644
--- a/app/services/metrics_service.rb
+++ b/app/services/metrics_service.rb
@@ -18,7 +18,7 @@ class MetricsService
end
def metrics_text
- "#{health_metrics_text}\n#{prometheus_metrics_text}"
+ "#{health_metrics_text}#{prometheus_metrics_text}"
end
private
diff --git a/lib/gitlab/health_checks/prometheus_text_format.rb b/lib/gitlab/health_checks/prometheus_text_format.rb
index 6b81eeddfc9..462c8e736a0 100644
--- a/lib/gitlab/health_checks/prometheus_text_format.rb
+++ b/lib/gitlab/health_checks/prometheus_text_format.rb
@@ -2,7 +2,7 @@ module Gitlab
module HealthChecks
class PrometheusTextFormat
def marshal(metrics)
- metrics_with_type_declarations(metrics).join("\n")
+ "#{metrics_with_type_declarations(metrics).join("\n")}\n"
end
private
diff --git a/spec/db/production/settings.rb b/spec/db/production/settings.rb
deleted file mode 100644
index 3cbb173c4cc..00000000000
--- a/spec/db/production/settings.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-require 'spec_helper'
-
-describe 'seed production settings', lib: true do
- include StubENV
-
- context 'GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN is set in the environment' do
- before do
- stub_env('GITLAB_SHARED_RUNNERS_REGISTRATION_TOKEN', '013456789')
- end
-
- it 'writes the token to the database' do
- load(File.join(__dir__, '../../../db/fixtures/production/010_settings.rb'))
- expect(ApplicationSetting.current.runners_registration_token).to eq('013456789')
- end
- end
-end
diff --git a/spec/lib/gitlab/health_checks/prometheus_text_format_spec.rb b/spec/lib/gitlab/health_checks/prometheus_text_format_spec.rb
index 7573792789a..ed757ed60d8 100644
--- a/spec/lib/gitlab/health_checks/prometheus_text_format_spec.rb
+++ b/spec/lib/gitlab/health_checks/prometheus_text_format_spec.rb
@@ -16,7 +16,7 @@ describe Gitlab::HealthChecks::PrometheusTextFormat do
metric2 2
EXPECTED
- expect(subject.marshal(sample_metrics)).to eq(expected.chomp)
+ expect(subject.marshal(sample_metrics)).to eq(expected)
end
context 'metrics where name repeats' do
@@ -34,7 +34,7 @@ describe Gitlab::HealthChecks::PrometheusTextFormat do
# TYPE metric2 gauge
metric2 3
EXPECTED
- expect(subject.marshal(sample_metrics)).to eq(expected.chomp)
+ expect(subject.marshal(sample_metrics)).to eq(expected)
end
end
end