aglinxinyuan commented on code in PR #4914: URL: https://github.com/apache/texera/pull/4914#discussion_r3180038427
########## amber/src/test/scala/org/apache/texera/amber/engine/architecture/worker/PauseTypeSpec.scala: ########## @@ -0,0 +1,102 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.texera.amber.engine.architecture.worker + +import org.apache.texera.amber.core.virtualidentity.EmbeddedControlMessageIdentity +import org.scalatest.flatspec.AnyFlatSpec + +class PauseTypeSpec extends AnyFlatSpec { + + // --- singletons ------------------------------------------------------------ + + "PauseType singletons" should "all extend the sealed trait PauseType" in { + val all: List[PauseType] = List(UserPause, BackpressurePause, OperatorLogicPause) + all.foreach(p => assert(p.isInstanceOf[PauseType])) + } Review Comment: Made the call: confirmed there is no priority/override-order semantics on `PauseType` — `PauseManager` stores active pauses in a `HashSet[PauseType]` (additive; resuming one type removes only that type), so the data type only has to behave well as Set elements. Kept the multi-pause behavior through `pause`/`resume`/`isPaused` in `WorkerManagersSpec` where the actual logic lives, and added three Set-based tests in this spec for what PauseManager directly relies on: - All four pause kinds coexist as distinct Set elements (no aliasing). - Set deduplicates identical pauses, so `PauseManager.pause(t)` on a duplicate is a no-op (singletons collapse, same-id `ECMPause` collapses). - `ECMPause` instances with different ids are independently tracked, so resuming one checkpoint pause does not clear another. Done in the latest commit. If a priority scheme later gets added to PauseType itself, that test would naturally live here too. -- 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]
