Skip to content

fix(test): use delta-based assertions for global Prometheus metrics in OCR3#21959

Open
Fletch153 wants to merge 1 commit intodevelopfrom
fix/CORE-2374-prometheus-global-state
Open

fix(test): use delta-based assertions for global Prometheus metrics in OCR3#21959
Fletch153 wants to merge 1 commit intodevelopfrom
fix/CORE-2374-prometheus-global-state

Conversation

@Fletch153
Copy link
Copy Markdown
Collaborator

Summary

  • OCR3 promwrapper tests assert exact counter/histogram values from global Prometheus metrics
  • With -count=N, these metrics accumulate across iterations, causing assertions to fail on iteration 2+
  • Fix captures initial metric values before test operations and asserts on deltas

Affected Tests

  • Test_ReportsGeneratedGauge — counter assertions
  • Test_DurationHistograms — histogram sample count assertions
  • Test_WrapperFactory — histogram sample count assertions

Test plan

  • All 3 tests pass with -count=100 -race locally
  • CI passes

Fixes: CORE-2374

…n OCR3

Global Prometheus counters/histograms registered via promauto accumulate
across test iterations when running with -count=N. Tests that assert
exact absolute values fail on the 2nd+ iteration.

Fix by capturing initial metric values before test operations and
asserting on the delta instead.

Fixes: CORE-2374
@Fletch153 Fletch153 requested review from a team as code owners April 10, 2026 13:35
@github-actions
Copy link
Copy Markdown
Contributor

👋 Fletch153, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Copy Markdown
Contributor

✅ No conflicts with other open PRs targeting develop

@trunk-io
Copy link
Copy Markdown

trunk-io bot commented Apr 10, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

Failed Test Failure Summary Logs
TestScripts/nodes/solana/list/list The test failed because it couldn't connect to the local server, resulting in command failures and connection refused errors. Logs ↗︎
Test_CLOSpecApprovalFlow_dynamicPriceGetter The test failed without a specific error message, likely due to an issue during test execution or setup. Logs ↗︎
TestScripts The test named 'TestScripts' failed during execution. Logs ↗︎
TestScripts/nodes/solana/list The test for listing Solana nodes failed during execution. Logs ↗︎

... and 1 more

View Full Report ↗︎Docs

@Fletch153
Copy link
Copy Markdown
Collaborator Author

/rerun

@cl-sonarqube-production
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant