Skip to content

test(security): drift IT waits for the cluster to settle - #563

Merged
bmscomp merged 1 commit into
mainfrom
fix/security-drift-settles
Oct 30, 2026
Merged

bmscomp merged 1 commit into
mainfrom
fix/security-drift-settles

Conversation

@bmscomp

@bmscomp bmscomp commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Why

main is red since #561's merge (714c5ec, run 41132651885): SecurityApiIT.baselineEnablesDriftAndDriftIsEmptyWithoutOne saw 44 of 45 checks unchanged. Nothing in #561 touches the security audit; this is a race the test always had.

The test assumed two back-to-back audits agree "because every check reads static broker configuration". The topic checks (RF=1, under-replicated partitions, internal topic protection, topic count) read the live topic list, and this class's broker is fresh. In the failing run the app's DLQ consumer subscribed at 21:47:35.069, between the baseline (35.051) and the drift read (35.191). Its group join creates __consumer_offsets, and its topic kates-dlq is auto-created, so a topic check changed. Drift reporting that is correct behaviour; the test's premise was wrong.

What

The test takes the baseline-then-drift pair again, every 200 ms for up to 30 s (ItSupport.waitUntil), until every check is unchanged. A baseline that did not round-trip through the V17 table never matches however long it waits, so the test still fails on the bug it exists for. Its message now lists the checks that drifted.

Test-only; no product change.

Tests

Locally, on real Postgres and Kafka (Testcontainers):

  • SecurityApiIT alone, 3 runs: 12/12 each. The scoped run trips the JaCoCo coverage gate, as any single-IT run does.
  • spotless:check.
  • The full ./mvnw verify: 1783 unit tests and 98 ITs, 0 failures, coverage gate passed.

I couldn't force the original race locally: it depends on startup timing.

SecurityApiIT.baselineEnablesDriftAndDriftIsEmptyWithoutOne failed on
main (714c5ec, run 41132651885): 44 of 45 checks unchanged. It assumed
two back-to-back audits agree because every check reads static broker
config, but the topic checks read the live topic list, and the class's
broker is fresh: half a second after start the app's DLQ consumer joins
its group (21:47:35.069 in the run), which creates __consumer_offsets and
auto-creates kates-dlq, between the baseline (35.051) and the drift read
(35.191). A topic check then differs, as drift should report.

The test now takes the baseline and drift pair again, every 200 ms for up
to 30 s, until every check is unchanged. A baseline that did not
round-trip through the V17 table never matches, so the test still fails
on the bug it exists for, and its message lists the checks that drifted.
@bmscomp
bmscomp merged commit d120b8c into main Oct 30, 2026
58 checks passed
@bmscomp
bmscomp deleted the fix/security-drift-settles branch October 30, 2026 22:14
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.

1 participant