Skip to content

Add unit tests for histogram proto conversions#7354

Merged
friedrichg merged 3 commits into
cortexproject:masterfrom
sophotechlabs:test/histogram-proto-conversions
Mar 20, 2026
Merged

Add unit tests for histogram proto conversions#7354
friedrichg merged 3 commits into
cortexproject:masterfrom
sophotechlabs:test/histogram-proto-conversions

Conversation

@archy-rock3t-cloud
Copy link
Copy Markdown
Contributor

What this PR does:

Adds unit tests for the histogram protobuf conversion functions in pkg/cortexpb/histograms.go. Tests cover round-trip conversions for both integer and float histograms, panic behavior when calling conversion functions with the wrong histogram type, HistogramPromProtoToHistogramProto for both int and float variants, and span conversion helpers including nil input handling.

Which issue(s) this PR fixes:
N/A

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: Artem Muterko <artem@sopho.tech>
Copy link
Copy Markdown
Member

@friedrichg friedrichg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

it would be nice to test HistogramProtoToFloatHistogram too

Comment thread pkg/cortexpb/histograms_test.go
Comment thread pkg/cortexpb/histograms_test.go
archy-rock3t-cloud and others added 2 commits March 16, 2026 18:57
Co-authored-by: Friedrich Gonzalez <1517449+friedrichg@users.noreply.github.com>
Signed-off-by: Archy <6429715+archy-rock3t-cloud@users.noreply.github.com>
Co-authored-by: Friedrich Gonzalez <1517449+friedrichg@users.noreply.github.com>
Signed-off-by: Archy <6429715+archy-rock3t-cloud@users.noreply.github.com>
Copy link
Copy Markdown
Member

@friedrichg friedrichg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Mar 20, 2026
@friedrichg friedrichg merged commit 63658c2 into cortexproject:master Mar 20, 2026
64 of 65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size/L type/tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants