Skip to content

o11ygin: fix flaky TestClientCancelled/cancel timer assertion - #1450

Open
circleci-app[bot] wants to merge 2 commits into
renovate/github.com-jackc-pgx-v5-5.xfrom
chunk/fix-flaky-o11ygin-client-cancelled
Open

o11ygin: fix flaky TestClientCancelled/cancel timer assertion#1450
circleci-app[bot] wants to merge 2 commits into
renovate/github.com-jackc-pgx-v5-5.xfrom
chunk/fix-flaky-o11ygin-client-cancelled

Conversation

@circleci-app

@circleci-app circleci-app Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

TestClientCancelled/cancel asserts an exact Value: 100.344581 for the handler timer metric. The CMPMetrics comparator only allows ~15ms of slack via EquateApprox, but the handler's observed duration depends on when the server sees the client-side cancel and can vary by tens of ms under CI load. In the failing job the handler saw the cancel at 63.79ms — well outside the 15ms tolerance.

The rest of the file already handles this pattern (see line 139) by passing cmpopts.IgnoreFields(fakemetrics.MetricCall{}, "Value", "ValueInt") alongside CMPMetrics. This change applies the same approach — but only ignores Value, so the ValueInt: 1 warning-count assertion is preserved.

Test plan

  • go test -run TestClientCancelled -count=3 -race -v ./o11y/wrappers/o11ygin/ passes locally 3× in a row
  • CI green

Run task

renovate Bot and others added 2 commits July 17, 2026 15:50
The subtest asserted an exact handler timer of ~100ms, but the value
depends on when the server sees the client-side cancel. Under CI load
the handler can observe the cancel tens of ms earlier, exceeding the
15ms tolerance provided by CMPMetrics and failing the test.

Match the pattern used elsewhere in this file (line 139) and ignore
the Value field for the comparison. Presence of the timer entry with
the expected Name/Tags is what the test actually cares about.

AI-Generated: true
@circleci-app
circleci-app Bot requested a review from a team as a code owner July 17, 2026 15:53
@renovate
renovate Bot force-pushed the renovate/github.com-jackc-pgx-v5-5.x branch 2 times, most recently from 904d34a to c515060 Compare July 17, 2026 16:14
@renovate
renovate Bot force-pushed the renovate/github.com-jackc-pgx-v5-5.x branch 2 times, most recently from 0488f27 to 40d4939 Compare August 12, 2026 03:31
@renovate
renovate Bot force-pushed the renovate/github.com-jackc-pgx-v5-5.x branch 2 times, most recently from bced0e7 to 38bc8aa Compare August 14, 2026 21:29
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.

0 participants