test: fix flaky AuditIntegrationTest await conditions [DHIS2-21858] (2.43)#24503
Merged
Conversation
…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
|
jbee
approved these changes
Jul 20, 2026
david-mackessy
approved these changes
Jul 21, 2026
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.



Backport of #24502 to 2.43.
Await conditions used
countAudits(query) >= 0(vacuously true) so tests raced the async Artemis audit consumer;testSaveRoutealso reusedBASE_UIDacross parameter runs, leaking audits between runs. Await>= 1and unique UID per run.Verified:
AuditIntegrationTest10/10 pass on this branch (Testcontainers Postgres).AI Assisted