Commit d26573c6 authored by Pawel Chojnacki's avatar Pawel Chojnacki

Make PrometheusTextFormat return proper output terminated with '\n'

remove file dangling after rebase
parent 6a67148e
...@@ -18,7 +18,7 @@ class MetricsService ...@@ -18,7 +18,7 @@ class MetricsService
end end
def metrics_text def metrics_text
"#{health_metrics_text}\n#{prometheus_metrics_text}" "#{health_metrics_text}#{prometheus_metrics_text}"
end end
private private
......
...@@ -2,7 +2,7 @@ module Gitlab ...@@ -2,7 +2,7 @@ module Gitlab
module HealthChecks module HealthChecks
class PrometheusTextFormat class PrometheusTextFormat
def marshal(metrics) def marshal(metrics)
metrics_with_type_declarations(metrics).join("\n") "#{metrics_with_type_declarations(metrics).join("\n")}\n"
end end
private private
......
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
...@@ -16,7 +16,7 @@ describe Gitlab::HealthChecks::PrometheusTextFormat do ...@@ -16,7 +16,7 @@ describe Gitlab::HealthChecks::PrometheusTextFormat do
metric2 2 metric2 2
EXPECTED EXPECTED
expect(subject.marshal(sample_metrics)).to eq(expected.chomp) expect(subject.marshal(sample_metrics)).to eq(expected)
end end
context 'metrics where name repeats' do context 'metrics where name repeats' do
...@@ -34,7 +34,7 @@ describe Gitlab::HealthChecks::PrometheusTextFormat do ...@@ -34,7 +34,7 @@ describe Gitlab::HealthChecks::PrometheusTextFormat do
# TYPE metric2 gauge # TYPE metric2 gauge
metric2 3 metric2 3
EXPECTED EXPECTED
expect(subject.marshal(sample_metrics)).to eq(expected.chomp) expect(subject.marshal(sample_metrics)).to eq(expected)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment