Sporadic test failures caused by async race condition

Description

Run this on GitHub Actions ubuntu-latest:

mvn test -Dtest=SynchronizationAPITests

50% of all runs have this failure:

[ERROR] SynchronizationAPITests.agedToLostEventShouldBeDeletedBeforeSynchronizationJobByUser:178 Expected: is <1> but: was <0>

The API processes the aged-to-lost event asynchronously, it returns a 201 success without waiting for the event being stored to database:
https://github.com/folio-org/mod-patron-blocks/blob/v1.7.0/src/main/java/org/folio/rest/impl/EventHandlersAPI.java#L88-L99

Therefore the test must wait until the event is in the database.

A similar issue:

[ERROR] UserSummaryServiceTest.shouldAddEvent:55 Expected true

CSP Request Details

None

CSP Rejection Details

None

Potential Workaround

None

Checklist

hide

TestRail: Results

Activity

Show:
Done

Details

Assignee

Reporter

Labels

Priority

Development Team

Vega

Fix versions

RCA Group

Implementation coding issue

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs

Created October 20, 2022 at 8:44 AM
Updated February 20, 2023 at 7:03 AM
Resolved October 21, 2022 at 9:33 PM
TestRail: Cases
TestRail: Runs

Flag notifications