smengcl opened a new pull request, #11014: URL: https://github.com/apache/ozone/pull/11014
Generated-by: Claude Code (Opus 4.8) ## What changes were proposed in this pull request? `TestSnapshotDiffManager#testLoadJobsOnStartUp` fails intermittently with `expected: <DONE> but was: <IN_PROGRESS>`. The test stubs `generateSnapshotDiffReport` with a `doAnswer` that writes `DONE` to the DB inside the answer body, calls `loadJobsOnStartUp()`, then waits with `attempt(() -> verify(spy, atLeast(1)).generateSnapshotDiffReport(...))` before reading the job back and asserting `DONE`. Mockito records an invocation before it runs the stubbed answer, so the `verify(...)` wait can pass as soon as the worker thread enters `generateSnapshotDiffReport`, while the answer is still running and has not yet persisted `DONE`. The main thread then reads the job and observes the original `IN_PROGRESS`, so the assertion fails. The fix waits on the actual observable end state the test asserts: it polls `getSnapshotDiffJobFromDb(...).getStatus()` until it is `DONE`, instead of waiting on the Mockito invocation. This is deterministic by construction because the read the assertion depends on is exactly what is waited on. No production code changes. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-16170 ## How was this patch tested? Ran the affected test locally against the change: ``` mvn -pl :ozone-manager -am test -Dtest='TestSnapshotDiffManager#testLoadJobsOnStartUp' -DskipShade -DskipRecon -DskipDocs -Dsurefire.failIfNoSpecifiedTests=false ``` A single green run cannot prove non-flakiness, so the fix is made deterministic by construction: the wait polls the same persisted job status that the subsequent assertion reads, closing the window between Mockito recording the invocation and the stubbed answer writing `DONE` to the DB. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
