test: fix flaky audit log and service account status tests#3068
Merged
talos-bot merged 1 commit intoJul 1, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces test flakiness in the Omni backend by preventing panics in the service account status reconcile test and by making audit log SQLite test seeding less sensitive to disk/WAL checkpoint contention.
Changes:
- Guard
PublicKeys[0]access behind a length check in the service account status reconcile test. - Seed large audit log datasets inside a single SQLite transaction to avoid many WAL autocommit checkpoints.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/backend/runtime/omni/controllers/omni/service_account_status_test.go | Avoids panics during polling by returning early when PublicKeys isn’t populated yet. |
| internal/backend/runtime/omni/audit/auditlog/auditlogsqlite/auditlogsqlite_test.go | Seeds test data in a single transaction to reduce WAL/fsync overhead and associated timeouts. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
071e6f3 to
eb9118e
Compare
smira
reviewed
Jul 1, 2026
| db.Put(seedConn) | ||
| }) | ||
|
|
||
| require.NoError(t, sqlitex.ExecuteTransient(seedConn, "BEGIN IMMEDIATE", nil)) |
Member
There was a problem hiding this comment.
I think we had all kinds of helpers for that: https://github.com/cosi-project/state-sqlite/blob/dc4746b7adf96a58e0c6b65f4cd2a85d0776ae18/pkg/state/impl/sqlite/modify.go#L312-L316
eb9118e to
55bc3ca
Compare
55bc3ca to
8861b8a
Compare
8861b8a to
f3b9ad9
Compare
The service account status test indexed PublicKeys[0] right after a non-fatal assert.Len. A slow reconcile that left the slice empty would panic instead of retrying, so the index access now sits behind the length check and the poller waits for the key to be aggregated. The two audit log tests seeded 1500 rows as separate autocommit transactions. Under full-suite disk contention those commits triggered enough checkpoint fsyncs to overrun the 30s context deadline mid-statement, so seeding now runs inside a single transaction. Signed-off-by: Oguz Kilcan <oguz.kilcan@siderolabs.com>
f3b9ad9 to
3ddc040
Compare
smira
approved these changes
Jul 1, 2026
Member
Author
|
/m |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The service account status test indexed PublicKeys[0] right after a non-fatal assert.Len. A slow reconcile that left the slice empty would panic instead of retrying, so the index access now sits behind the length check and the poller waits for the key to be aggregated.
The two audit log tests seeded 1500 rows as separate autocommit transactions. Under full-suite disk contention those commits triggered enough checkpoint fsyncs to overrun the 30s context deadline mid-statement, so seeding now runs inside a single transaction.