Copilot commented on code in PR #4871: URL: https://github.com/apache/texera/pull/4871#discussion_r3178735635
########## amber/src/test/integration/org/apache/texera/amber/tags/IntegrationTest.java: ########## @@ -0,0 +1,48 @@ +/* + * 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.tags; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.scalatest.TagAnnotation; + +/** + * Class-level marker tag for ScalaTest specs that exercise both Scala + * and Python end-to-end. Routing to the {@code amber-integration} CI + * job is path-based (specs live under {@code amber/src/test/integration}) + * via a dedicated {@code IntegrationTest} sbt configuration; this + * annotation is kept for IDE / reader clarity and so a future ScalaTest + * tag-filter (e.g. {@code -n org.apache.texera.amber.tags.IntegrationTest}) + * also works. Review Comment: The Javadoc claims routing to the amber-integration job is “path-based … via a dedicated IntegrationTest sbt configuration”, but this PR actually routes tests via ScalaTest tag filtering controlled by AMBER_TEST_FILTER in amber/build.sbt (no separate sbt config). Please update the comment to match the implemented mechanism to avoid misleading future changes/debugging. ########## .github/labeler.yml: ########## @@ -45,15 +45,47 @@ agent-service: - 'agent-service/**' engine: + # Non-Python, non-integration parts of amber/. Pure Python changes + # under amber/src/main/python/** intentionally fall through to the + # `python` label (which the labeler also matches via **/*.py), so + # they only trigger the python + amber-integration stacks rather + # than the full Scala-only `amber` stack. Integration specs live + # under amber/src/test/integration/** (added to sbt's Test sources + # via amber/build.sbt) and are caught by the `amber-integration` + # label below. - changed-files: - any-glob-to-any-file: - - 'amber/**' + - 'amber/build.sbt' + - 'amber/project/**' + - 'amber/src/main/scala/**' + - 'amber/src/main/java/**' + - 'amber/src/main/protobuf/**' + - 'amber/src/main/resources/**' + - 'amber/src/test/scala/**' + - 'amber/src/test/java/**' + +amber-integration: + # Scala specs that exercise both Scala and Python end-to-end. They + # live under amber/src/test/integration/scala/** (sbt's Test config + # picks them up via amber/build.sbt) and are tagged Review Comment: This comment says integration specs live under `amber/src/test/integration/scala/**`, but the actual path introduced in this PR is `amber/src/test/integration/org/...` (and the matcher below is `amber/src/test/integration/**`). Please fix the comment to reflect the real layout. ########## amber/src/test/integration/org/apache/texera/amber/engine/e2e/ReconfigurationIntegrationSpec.scala: ########## @@ -0,0 +1,291 @@ +/* + * 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.e2e + +import com.twitter.util.{Await, Duration, Promise} +import com.typesafe.scalalogging.Logger +import org.apache.pekko.actor.{ActorSystem, Props} +import org.apache.pekko.testkit.{ImplicitSender, TestKit} +import org.apache.pekko.util.Timeout +import org.apache.texera.amber.clustering.SingleNodeListener +import org.apache.texera.amber.core.executor.{OpExecInitInfo, OpExecWithCode} +import org.apache.texera.amber.core.storage.DocumentFactory +import org.apache.texera.amber.core.storage.model.VirtualDocument +import org.apache.texera.amber.core.tuple.Tuple +import org.apache.texera.amber.core.virtualidentity.OperatorIdentity +import org.apache.texera.amber.core.workflow.{PortIdentity, WorkflowContext} +import org.apache.texera.amber.engine.architecture.controller.{ + ControllerConfig, + ExecutionStateUpdate +} +import org.apache.texera.amber.engine.architecture.rpc.controlcommands.{ + EmptyRequest, + UpdateExecutorRequest, + WorkflowReconfigureRequest +} +import org.apache.texera.amber.engine.architecture.rpc.controlreturns.WorkflowAggregatedState.{ + COMPLETED, + PAUSED +} +import org.apache.texera.amber.engine.common.AmberRuntime +import org.apache.texera.amber.engine.common.client.AmberClient +import org.apache.texera.amber.engine.e2e.TestUtils.{ + cleanupWorkflowExecutionData, + initiateTexeraDBForTestCases, + setUpWorkflowExecutionData, + stateReached +} +import org.apache.texera.amber.operator.{LogicalOp, TestOperators} +import org.apache.texera.amber.tags.IntegrationTest +import org.apache.texera.web.resource.dashboard.user.workflow.WorkflowExecutionsResource.getResultUriByLogicalPortId +import org.apache.texera.workflow.LogicalLink +import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach, Outcome, Retries} +import org.scalatest.flatspec.AnyFlatSpecLike + +import scala.concurrent.duration._ + +/** + * E2E reconfiguration tests that spawn Python UDF workers. Routed to the + * `amber-integration` CI job via the class-level `@IntegrationTest` tag, + * which provisions Python deps; the lighter `amber` job excludes this tag. + * + * Pure-Scala reconfiguration tests live in [[ReconfigurationSpec]] and run + * in the regular `amber` job. + */ +@IntegrationTest +class ReconfigurationIntegrationSpec + extends TestKit(ActorSystem("ReconfigurationIntegrationSpec", AmberRuntime.akkaConfig)) + with ImplicitSender + with AnyFlatSpecLike + with BeforeAndAfterAll + with BeforeAndAfterEach + with Retries { + + /** + * This block retries each test once if it fails. + * In the CI environment, there is a chance that executeWorkflow does not receive "COMPLETED" status. + * Until we find the root cause of this issue, we use a retry mechanism here to stabilize CI runs. + */ + override def withFixture(test: NoArgTest): Outcome = + withRetry { super.withFixture(test) } + + implicit val timeout: Timeout = Timeout(5.seconds) + + val logger = Logger("ReconfigurationIntegrationSpecLogger") + val ctx = new WorkflowContext() + + override protected def beforeEach(): Unit = { + setUpWorkflowExecutionData() + } + + override protected def afterEach(): Unit = { + cleanupWorkflowExecutionData() + } + + override def beforeAll(): Unit = { + system.actorOf(Props[SingleNodeListener](), "cluster-info") + // These test cases access postgres in CI, but occasionally the jdbc driver cannot be found during CI run. + // Explicitly load the JDBC driver to avoid flaky CI failures. + Class.forName("org.postgresql.Driver") + initiateTexeraDBForTestCases() + } + + override def afterAll(): Unit = { + TestKit.shutdownActorSystem(system) + } + + def shouldReconfigure( + operators: List[LogicalOp], + links: List[LogicalLink], + targetOps: Seq[LogicalOp], + newOpExecInitInfo: OpExecInitInfo + ): Map[OperatorIdentity, List[Tuple]] = { + val workflow = Review Comment: `shouldReconfigure` and the surrounding workflow-driver logic appear duplicated from `ReconfigurationSpec`. To reduce drift as future e2e specs move over, consider extracting the shared helper into a common test utility (e.g., `TestUtils`) and reusing it from both specs. ########## .github/labeler.yml: ########## @@ -45,15 +45,47 @@ agent-service: - 'agent-service/**' engine: + # Non-Python, non-integration parts of amber/. Pure Python changes + # under amber/src/main/python/** intentionally fall through to the + # `python` label (which the labeler also matches via **/*.py), so + # they only trigger the python + amber-integration stacks rather + # than the full Scala-only `amber` stack. Integration specs live + # under amber/src/test/integration/** (added to sbt's Test sources + # via amber/build.sbt) and are caught by the `amber-integration` + # label below. - changed-files: - any-glob-to-any-file: - - 'amber/**' + - 'amber/build.sbt' + - 'amber/project/**' + - 'amber/src/main/scala/**' + - 'amber/src/main/java/**' + - 'amber/src/main/protobuf/**' + - 'amber/src/main/resources/**' + - 'amber/src/test/scala/**' + - 'amber/src/test/java/**' + Review Comment: The new `engine` label no longer matches `amber/.scalafmt.conf` and `amber/.scalafix.conf` (both exist). A PR that only changes those files would end up with an empty stack union and could skip all CI checks. Consider adding those paths under `engine` (or mapping them to `common`) so formatting/lint config changes still run the Scala stacks. -- 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]
