eugenegujing opened a new pull request, #7312: URL: https://github.com/apache/texera/pull/7312
### What changes were proposed in this PR? Adds `CoordinatorTimerServiceSpec` (new, 13 tests) for `amber/src/main/scala/org/apache/texera/amber/engine/architecture/coordinator/CoordinatorTimerService.scala`, which had no spec. No production code is changed. The spec substitutes a `PekkoActorService` that records `sendToSelfWithFixedDelay` requests instead of registering real repeating timers, and returns a fresh recording `Cancellable` per call. A real `ActorContext` comes from a minimal Pekko TestKit actor, since `PekkoActorService` dereferences `self`/`dispatcher` eagerly and there is no Mockito in the amber test tree. Every timing decision the class makes is taken synchronously at the `enable`/`disable` call, so the suite needs no real timers and no sleeps. Covered: - **Scheduling decision** — an unconfigured interval schedules nothing; a configured one schedules exactly once with initial delay 0, the configured period, and a `ControlInvocation` of `METHOD_COORDINATOR_INITIATE_QUERY_STATISTICS` carrying `QueryStatisticsRequest(Seq.empty, target)` and `AsyncRPCContext(SELF, SELF)`. - **The two entry points do not cross** — `enableStatusUpdate` uses `statusUpdateIntervalMs` with `UI_ONLY`, `enableRuntimeStatisticsCollection` uses `runtimeStatisticsPersistenceIntervalMs` with `PERSISTENCE_ONLY`, asserted separately and with distinct intervals; an asymmetric config (only one interval set) leaves the other timer unscheduled. - **Idempotence** — a second `enable` while the timer runs adds no schedule and keeps the same `Cancellable` instance. - **Disable** — cancels the handle and resets it to `None`, including when `cancel()` returns `false` (the return value is discarded by `disableTimer`); a second disable and a disable of a never-enabled timer are both no-ops. - **Restart and lifecycle** — a disabled timer can be enabled again, for both timers; a full pause-resume cycle re-schedules both with their own target and interval. - **Independence** — disabling one timer leaves the other's handle installed and un-cancelled, in both directions. ### Any related issues, documentation, discussions? Closes #7311. ### How was this PR tested? ``` sbt "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.architecture.coordinator.CoordinatorTimerServiceSpec" # 13 tests, all passed (~0.6 s) sbt "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.architecture.coordinator.*" # 18 suites, 146 tests, all passed — the new top-level test helpers do not clash with the neighboring specs sbt "WorkflowExecutionService/Test/scalafmtCheck" # 173 sources, clean ``` ### Was this PR authored or co-authored using generative AI tooling? Co-authored by: Claude Code (Fable 5) -- 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]
