Skip to content

Keep index building out of the retention window in the audit retention tests - #5874

Merged
ramonsmits merged 1 commit into
masterfrom
ramon/audit-retention-tests-wait-for-index
Sep 10, 2026
Merged

ramonsmits merged 1 commit into
masterfrom
ramon/audit-retention-tests-wait-for-index

Conversation

@ramonsmits

Copy link
Copy Markdown
Member

AuditMessageRetention and SagaSnapshotRetention failed four times in the last 60 CI runs, always on the query that should still see the document. The two second retention window starts at ingestion, and on a busy Windows runner building the fresh database's indexes ate the whole window before the query ran.

The tests now wait for the indexes before ingesting, use a three second window with a one second expiration pass, and poll for expiry instead of sleeping a fixed four seconds. Passes three runs in a row locally at 7 s and 4 s.

…ion tests

The two second retention window started at ingestion, while the fresh
database's indexes were still being built, and on a busy runner that alone
took longer than the window, so the query that should see the document
before it expires found nothing. The indexes are now built before
ingestion, and the fixed four second sleep is replaced by polling, so the
test takes as long as expiration actually needs.

// Polls instead of sleeping for a fixed time, so the test takes as long as expiration actually
// needs and still tolerates a slow expiration pass.
static async Task<T> WaitUntil<T>(Func<CancellationToken, Task<T>> query, Func<T, bool> condition)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So we have no existing helper that already does that?

@ramonsmits
ramonsmits merged commit 2b06e48 into master Sep 10, 2026
69 of 70 checks passed
@ramonsmits
ramonsmits deleted the ramon/audit-retention-tests-wait-for-index branch September 10, 2026 12:37
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.

3 participants