Copilot commented on code in PR #6099: URL: https://github.com/apache/texera/pull/6099#discussion_r3522882950
########## common/workflow-operator/src/test/scala/org/apache/texera/amber/util/ObjectMapperUtilsSpec.scala: ########## @@ -0,0 +1,41 @@ +/* + * 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.util + +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers + +class ObjectMapperUtilsSpec extends AnyFlatSpec with Matchers { + + private def findWarmupThread(): Option[Thread] = { + val threads = new Array[Thread](Thread.activeCount() * 2 + 16) + val count = Thread.enumerate(threads) + threads.take(count).find(t => t != null && t.getName == "ObjectMapperWarmupForOperatorsThread") + } + + "warmupObjectMapperForOperatorsSerde" should "spawn the named warmup thread and complete" in { + noException should be thrownBy ObjectMapperUtils.warmupObjectMapperForOperatorsSerde() + // join the spawned thread so its run() body (operator-metadata generation) actually executes + findWarmupThread().foreach { thread => + thread.join(60000) + thread.isAlive shouldBe false + } Review Comment: This test currently doesn’t actually assert that the warmup thread was spawned: `findWarmupThread()` is optional and the test still passes if it returns `None` (e.g., if the method becomes a no-op or if the thread isn’t observed due to timing). That makes the coverage goal ineffective and can hide regressions. -- 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]
