Skip to content

Commit 56758c5

Browse files
bc-dhruvinclaude
andcommitted
INFRA-25589: test fix Content-Type header spec for Prometheus exposition format 0.0.4
Update rack_app_spec to assert the correct `version=0.0.4` parameter in the Content-Type header. Add dedicated assertion in metrics_controller_spec since that is where the header is set. Tighten CHANGELOG entry wording. Fixes INFRA-25589 Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6004ef8 commit 56758c5

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Changelog for the bc-prometheus-ruby gem.
44

55
## 0.8.2
66

7-
- Fix Prometheus 3.x Content-Type compliance: add `version=0.0.4` qualifier to the `text/plain` Content-Type header served by the Puma metrics controller (INFRA-25589)
7+
- Add `version=0.0.4` to `Content-Type` header for Prometheus exposition format 0.0.4 compliance (INFRA-25589)
88

99
## 0.8.1
1010

spec/bigcommerce/prometheus/servers/puma/controllers/metrics_controller_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
ruby_collector_sessions_total 19'
5050
end
5151

52+
it 'sets Prometheus text format 0.0.4 content type' do
53+
expect(subject.headers['Content-Type']).to eq('text/plain; version=0.0.4; charset=utf-8')
54+
end
55+
5256
context 'when the metrics fail to parse' do
5357
let(:timeout_exception) { ::Timeout::Error }
5458
before do

spec/bigcommerce/prometheus/servers/puma/rack_app_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
}
4242
end
4343

44-
it 'returns content type of text/plain' do
44+
it 'returns Prometheus text format 0.0.4 content type' do
4545
_status, headers, _body = subject
46-
expect(headers['Content-Type']).to eq('text/plain; charset=utf-8')
46+
expect(headers['Content-Type']).to eq('text/plain; version=0.0.4; charset=utf-8')
4747
end
4848
end
4949

0 commit comments

Comments
 (0)