Skip to content

test: fix flaky AuditIntegrationTest await conditions [DHIS2-21858] (2.43)#24503

Merged
netroms merged 1 commit into
2.43from
DHIS2-21858-flaky-audit-test-2.43
Jul 21, 2026
Merged

test: fix flaky AuditIntegrationTest await conditions [DHIS2-21858] (2.43)#24503
netroms merged 1 commit into
2.43from
DHIS2-21858-flaky-audit-test-2.43

Conversation

@netroms

@netroms netroms commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Backport of #24502 to 2.43.

Await conditions used countAudits(query) >= 0 (vacuously true) so tests raced the async Artemis audit consumer; testSaveRoute also reused BASE_UID across parameter runs, leaking audits between runs. Await >= 1 and unique UID per run.

Verified: AuditIntegrationTest 10/10 pass on this branch (Testcontainers Postgres).

AI Assisted

…2.43)

The await conditions used countAudits(query) >= 0 which is vacuously
true, so the tests never actually waited for the async Artemis audit
consumer and raced it instead (expected 1 audit but was 0).

testSaveRoute additionally reused the shared BASE_UID for every
AuthScheme parameter run. Audit rows are written outside the test
transaction and are not rolled back, so a late audit from a previous
run leaked into the next run's query (expected 1 but was 2).

Await >= 1 and use a unique UID per parameterized run.

AI Assisted
@sonarqubecloud

Copy link
Copy Markdown

@netroms
netroms merged commit 090c8ea into 2.43 Jul 21, 2026
18 checks passed
@netroms
netroms deleted the DHIS2-21858-flaky-audit-test-2.43 branch July 21, 2026 07:34
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