Skip to content

test(billing): make peak-rate usage tests independent of wall clock - #8743

Merged
Wei-Shaw merged 1 commit into
Wei-Shaw:mainfrom
r266-tech:codex/fix-peak-rate-usage-test
Nov 16, 2026
Merged

Wei-Shaw merged 1 commit into
Wei-Shaw:mainfrom
r266-tech:codex/fix-peak-rate-usage-test

Conversation

@r266-tech

Copy link
Copy Markdown
Contributor

跟进 #8742 的 unit 失败。

两个图片 token 计费测试把峰时窗口设为 [00:00, 23:59),却没有传入 PricingAt,因此每天 UTC 最后一分钟会合法得到 1 倍费率,仍被测试断言为 3 倍。该 CI 失败发生在 23:59:29.905Z。

为 OpenAI 和通用网关的两个原测试显式传入 UTC 正午的计费时刻,保留全部倍率、图片 token、成本和扣费断言。

验证:

  • Go 1.27.3 / Linux arm64:用本地 Go overlay 固定 timezone.Now。原 main 和 fix(gateway): preserve message output config with per-turn beta #8742 的失败用例在日志时刻均复现 expected 3 / actual 1;两个原测试在该时刻均失败、正午均通过,修复后两种时钟均通过。
  • Go 1.27.3 / macOS arm64,最终 go test -p=1 -tags=unit ./... -count=1 -json:26,879 通过、41 跳过。
  • go test -p=2 -tags=integration ./... -count=1 -json:16,143 通过、16 跳过。
  • CI 固定的 golangci-lint v2.14.0 全后端检查及 unit 标签的增量检查均为 0 问题;git diff --check 通过。

AI 辅助实现与本地验证。主线 Go 1.27.3 安全检查的工具链修复由 #8670 单独跟踪。

@Wei-Shaw
Wei-Shaw merged commit 6247d33 into Wei-Shaw:main Nov 16, 2026
8 of 9 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants