Files
coder/enterprise/coderd
Yevhenii Shcherbina 2ec7f5c69b test: fix TestUserAIBudgetOverride audit flake (#27013)
Closes
https://linear.app/codercom/issue/AIGOV-502/flake-testuseraibudgetoverrideauditupsertspendlimit

The `Audit/UpsertEverything` and `Audit/UpsertSpendLimit` subtests
grabbed `rows[0]` from `GetAuditLogsOffset`, assuming strict time-desc
order. Both upserts emit `AuditActionWrite` against the same override
with no ordering tiebreaker, so when the create and update entries share
a timestamp the create entry could sort first and fail the assertion.

Select the update entry by the spend limit it results in via a new
`auditLogByNewSpendLimit` helper instead of by row position.

<hr/>

We could make `auditLogByNewSpendLimit` more generic, but since we don't
have any other use cases for it right now, I think we can postpone that
until the need arises.

Related PR: https://github.com/coder/coder/pull/26630/changes
2026-07-06 14:18:02 -04:00
..
2022-08-22 15:02:50 -07:00