Skip to content

Fix race in batch timeout observer test - #223

Merged
vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix-batch-observer-test-race
Nov 4, 2026
Merged

vharseko merged 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix-batch-observer-test-race

Conversation

@vharseko

@vharseko vharseko commented Nov 4, 2026

Copy link
Copy Markdown
Member

BatchApiOpImplTest.testExecuteBatchFailsWhenNoTokenArrives intermittently fails because it checks the observer immediately after executeBatch throws. The promise wakes its waiting caller before invoking exception listeners, so observer.onError may not have recorded the error yet.

The recording observer now signals a CountDownLatch after storing the error, and the test waits up to five seconds before checking it. The existing checks for the exception type, operation duration, and absence of onCompleted remain in place.

Observed failure: macOS / Java 27 build.

Validation:

  • In a temporary copy of the test, delayed error recording inside onError by 250 ms: the original test failed with the CI assertion; the fixed test passed. The delay is not part of this change.
  • On macOS / Java 27, mvn -o -B -pl OpenICF-java-framework/connector-framework-server -am package -Dmaven.javadoc.skip=true succeeded: 789 tests, zero failures or errors, two skipped; all 33 server-module tests passed.
  • git diff --check passed.

@vharseko
vharseko requested a review from maximthomas November 4, 2026 13:41
@vharseko vharseko added java Pull requests that update java code tests Test additions or fixes flaky-test Test that fails intermittently in CI framework OpenICF-java-framework concurrency Races, locking and thread-safety fixes labels Nov 4, 2026

@maximthomas maximthomas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vharseko
vharseko merged commit 7c32027 into OpenIdentityPlatform:master Nov 4, 2026
15 checks passed
@vharseko
vharseko deleted the fix-batch-observer-test-race branch November 4, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

concurrency Races, locking and thread-safety fixes flaky-test Test that fails intermittently in CI framework OpenICF-java-framework java Pull requests that update java code tests Test additions or fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants