Skip to content

Fix TempLocationManagerTest flakiness#11239

Open
jbachorik wants to merge 2 commits intomasterfrom
jb/tempman_tests
Open

Fix TempLocationManagerTest flakiness#11239
jbachorik wants to merge 2 commits intomasterfrom
jb/tempman_tests

Conversation

@jbachorik
Copy link
Copy Markdown
Contributor

@jbachorik jbachorik commented Apr 30, 2026

What Does This Do

Stops TempLocationManagerTest.testConcurrentCleanup from depending on the shared AgentTaskScheduler. Cleanup now runs on a dedicated thread owned by the test, with a try/finally that always drains the worker on assertion failure.

Also tightens the test suite:

  • testCleanup: replace the buggy assertFalse(rslt && Files.exists(...)) (which silently passed when cleanup failed) with explicit assertTrue(rslt) + assertFalse(Files.exists(...)). Replace the fragile walk-up loop with TempLocationManager.getBaseTempDirName().
  • testCleanup: route through the existing private instance(...) helper for consistency.
  • testCleanupWithTimeout: drop the unreachable visitFileFailed override (no @MethodSource argument ever selects it).
  • testConcurrentCleanup: hooks now return the CleanupHook default rather than null, register baseDir.deleteOnExit(), and add an assertFalse(cleanupThread.isAlive()) sanity check.

Motivation

Recurring CI flake: Cleanup thread should reach hook within 30 seconds expected: <true> but was: <false>. Root cause is the test's cleanup task being queued in the shared AgentTaskScheduler worker behind cleanup tasks scheduled by other tests in the same JVM.

Additional Notes

Verified by running testConcurrentCleanup 5 times in a row locally — all green.

Contributor Checklist

Run cleanup on a dedicated thread instead of the shared AgentTaskScheduler
so testConcurrentCleanup is not queued behind cleanup tasks scheduled by
other tests in the same JVM. Also fix a buggy assertion that masked
cleanup failures, drop a dead visitFileFailed override, and minor cleanup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jbachorik jbachorik added type: bug Bug report and fix tag: no release notes Changes to exclude from release notes comp: profiling Profiling tag: ai generated Largely based on code generated by an AI or LLM labels Apr 30, 2026
@jbachorik jbachorik marked this pull request as ready for review April 30, 2026 10:17
@jbachorik jbachorik requested a review from a team as a code owner April 30, 2026 10:17
@jbachorik jbachorik requested a review from dougqh April 30, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: profiling Profiling tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: bug Bug report and fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants