Yicong-Huang opened a new pull request, #4518: URL: https://github.com/apache/texera/pull/4518
### What changes were proposed in this PR? `PauseSpec.shouldPause` and `ReconfigurationSpec.shouldReconfigure` used hardcoded `Thread.sleep` calls to wait for the engine to settle into `PAUSED` before each next action: - `PauseSpec.scala:111-117`: three sleeps — `Thread.sleep(4000)` + `Thread.sleep(400)` + `Thread.sleep(4000)` — per call. With 2 tests in the spec, that was ~16.8s of pure sleep. - `ReconfigurationSpec.scala:151`: one `Thread.sleep(4000)` after `pauseWorkflow`. `AmberClient` already exposes `registerCallback[ExecutionStateUpdate]`, so a Promise that resolves on the target state is a drop-in replacement and exits as soon as the engine transitions. Adds a `stateReached(client, target)` helper in `TestUtils` and uses it in both specs to wait for `PAUSED`. The 400ms sleep after `resumeWorkflow` is **kept** for now: `ResumeHandler` does not emit an `ExecutionStateUpdate` after resume (tracked in #4514). Once that fix lands, the 400ms sleep can be removed in a follow-up. The 1000ms sleep inside `ReconfigurationSpec`'s `COMPLETED` callback is also left alone — its TODO marks it as a workaround for a separate completion-reporting bug. ### Any related issues, documentation, discussions? Closes #4517. Related: #4514 (ResumeHandler missing state emit; would unblock removing the residual 400ms sleep). ### How was this PR tested? Local timing on the worktree (warm sbt + DB): | spec | before | after | |---|---|---| | `PauseSpec` (2 tests) | `Run completed in 41 seconds, 869 milliseconds` | `Run completed in 28 seconds, 791 milliseconds` | `ReconfigurationSpec` cannot be measured locally on JDK 17 (Apache Arrow `MemoryUtil` reflection fails without `--add-opens java.base/java.nio=ALL-UNNAMED`); CI on JDK 11 will exercise the change. All existing assertions in both specs are preserved. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 4.7) -- 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]
