Skip to content

[Test] CompletableIsolatedTest.repeatNormal has a wall-clock-dependent call-count assertion #8372

Closed

Description

@jimi-21

Problem

CompletableIsolatedTest.repeatNormal depends on wall-clock timing for an exact call-count assertion.

The test schedules disposal after 1100 ms, while the callable sleeps for 200 ms on each invocation, and immediately asserts exactly 6 calls. This boundary is sensitive to scheduler and machine timing jitter.

Evidence from local verification

Using both Temurin and Zulu 26.0.2.1, Gradle 9.9.0, on Windows:

  • During full-suite runs of 14,296 JUnit tests, the test failed intermittently with calls count mismatch:
    • expected: <6> but was: <5>
    • expected: <6> but was: <7>
  • Running CompletableIsolatedTest.repeatNormal independently passed.
  • The upstream file at 4.x matches the unmodified original used for these runs.

Relevant code:

@Isolated prevents interference from other tests, but does not remove timing jitter in this test itself.

Suggested direction

Please consider making the synchronization deterministic (for example, a scheduler/latch-based arrangement) or otherwise avoiding a hard exact-count assertion at a real-time boundary.

AI disclosure: Kimi Code assisted with reproducing and analyzing the timing issue and drafting this report. No production-code patch is attached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions