This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-9597-cd5e257ba5f4cc9363a60cb5a99e82d0174fd9d6 in repository https://gitbox.apache.org/repos/asf/texera.git
commit 6a16e1a58926368a3e9ea4cfad61cfb20daacd26 Author: Xinyuan Lin <[email protected]> AuthorDate: Mon Nov 23 12:53:54 2026 +0000 test(amber, common): remove unused spec mixins and bindings (#9597) ### What changes were proposed in this PR? Remove unused ScalaTest mixin traits, unread local exception bindings, and type checks that cannot fail across 31 test specs in `amber`, `common/workflow-core`, and `common/workflow-operator`, and shut down the actor systems of the two `TestKit` specs that never did. No production code changes: - **Unused `MockFactory` mixin (`amber`):** Remove the `MockFactory` trait and import in `NetworkInputGatewaySpec`, `CostBasedScheduleGeneratorSpec`, `RangeBasedShuffleSpec`, and `WorkerSpec`, which create no mocks or stubs. - **Unused `BeforeAndAfterEach` mixin (`amber`, `common/workflow-core`):** Remove the trait and import in `BatchSizePropagationSpec`, `DataProcessorSpec`, `TrivialControlSpec`, `FileResolverSpec`, `LargeBinaryInputStreamSpec`, `LargeBinaryOutputStreamSpec`, and `S3StorageClientSpec`, which define no per-test hooks. - **Unused or redundant `BeforeAndAfterAll` mixin (`amber`, `common/workflow-core`):** Remove it from `DefaultCostEstimatorSpec`, `IcebergDocumentConsoleMessagesSpec`, and `LakeFSStorageClientMtimeSpec`, which define no suite hooks, and from `LargeBinaryInputStreamSpec`, `LargeBinaryOutputStreamSpec`, and `S3StorageClientSpec`, whose `S3StorageTestBase` already extends it; their `super.beforeAll()`/`super.afterAll()` chains are unchanged. - **Missing actor-system shutdown (`amber`):** `LoggingSpec` and `ReplaySpec` mixed in `BeforeAndAfterAll` with no hook and never shut down their `TestKit` actor systems; they now call `TestKit.shutdownActorSystem(system)` in `afterAll`, like the other `TestKit` specs. - **Unused `BeforeAndAfter` mixin (`common/workflow-operator`):** Remove the trait and import in `URLFetcherOpExecSpec`, `TypeCastingOpExecSpec`, `HtmlVizOpExecSpec`, and `KeywordSearchOpExecSpec`, which have no `before`/`after` blocks. - **Unread `val ex =` bindings and type checks that cannot fail (`common/workflow-operator`):** Drop 17 unread `val ex =` assignments on `expectError[AssertionError](...)` calls across 10 visualization operator specs (`ImageVisualizerOpDescSpec`, `ScatterMatrixChartOpDescSpec`, `ContinuousErrorBandsOpDescSpec`, `FigureFactoryTableOpDescSpec`, `HistogramChartOpDescSpec`, `TablesPlotOpDescSpec`, `TernaryContourOpDescSpec`, `TernaryPlotOpDescSpec`, `WaterfallChartOpDescSpec`, and `WindRoseChartOpDescSpec`). In `ContinuousErrorBandsOpDescSpec`, `NestedTableOpDescSpec`, `WaterfallChartOpDescSpec`, and `WindRoseChartOpDescSpec`, also replace each `val ex = expectError[AssertionError](...)` followed by `ex shouldBe a[AssertionError]` with a bare `expectError` call, since `expectError` already returns the intercepted `AssertionError`. ### Any related issues, documentation, discussions? Closes #9595. ### How was this PR tested? Ran on `7e79747ea8` (JDK 17.0.14, `sbt 1.12.9`, `STORAGE_ICEBERG_CATALOG_TYPE=hadoop`, Docker running for the `WorkflowCore` RustFS and LakeFS test containers): ```bash sbt --batch \ "WorkflowCore/scalafmtCheckAll" \ "WorkflowOperator/scalafmtCheckAll" \ "WorkflowExecutionService/scalafmtCheckAll" \ "WorkflowCore/scalafixAll --check" \ "WorkflowOperator/scalafixAll --check" \ "WorkflowExecutionService/scalafixAll --check" sbt --batch "WorkflowOperator/testOnly org.apache.texera.amber.operator.keywordSearch.KeywordSearchOpExecSpec org.apache.texera.amber.operator.source.fetcher.URLFetcherOpExecSpec org.apache.texera.amber.operator.typecasting.TypeCastingOpExecSpec org.apache.texera.amber.operator.visualization.ImageViz.ImageVisualizerOpDescSpec org.apache.texera.amber.operator.visualization.ScatterMatrixChart.ScatterMatrixChartOpDescSpec org.apache.texera.amber.operator.visualization.continuousErrorBand [...] sbt --batch "WorkflowCore/testOnly org.apache.texera.amber.storage.FileResolverSpec org.apache.texera.service.util.LargeBinaryInputStreamSpec org.apache.texera.service.util.LargeBinaryOutputStreamSpec org.apache.texera.service.util.S3StorageClientSpec org.apache.texera.amber.core.storage.util.LakeFSStorageClientMtimeSpec" sbt --batch "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.architecture.messaginglayer.NetworkInputGatewaySpec org.apache.texera.amber.engine.architecture.messaginglayer.RangeBasedShuffleSpec org.apache.texera.amber.engine.architecture.scheduling.CostBasedScheduleGeneratorSpec org.apache.texera.amber.engine.architecture.scheduling.DefaultCostEstimatorSpec org.apache.texera.amber.engine.architecture.worker.DataProcessorSpec org.apache.texera.amber.engine.architecture [...] ``` - `scalafmtCheckAll` and `scalafixAll --check` across `WorkflowCore`, `WorkflowOperator`, and `WorkflowExecutionService`: passed. - `WorkflowOperator`: `15` suites, `94` passed (`0` failed, `0` skipped). - `WorkflowCore`: `5` suites, `118` passed (`0` failed, `0` skipped). - `WorkflowExecutionService`: `11` suites, `65` passed (`0` failed, `0` skipped). ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Antigravity (Gemini 4 Neon), Claude Code (Claude Opus 5.5) --- .../result/iceberg/IcebergDocumentConsoleMessagesSpec.scala | 4 +--- .../engine/architecture/control/TrivialControlSpec.scala | 3 +-- .../architecture/messaginglayer/NetworkInputGatewaySpec.scala | 3 +-- .../architecture/messaginglayer/RangeBasedShuffleSpec.scala | 3 +-- .../scheduling/CostBasedScheduleGeneratorSpec.scala | 3 +-- .../architecture/scheduling/DefaultCostEstimatorSpec.scala | 3 +-- .../amber/engine/architecture/worker/DataProcessorSpec.scala | 3 +-- .../texera/amber/engine/architecture/worker/WorkerSpec.scala | 4 +--- .../texera/amber/engine/e2e/BatchSizePropagationSpec.scala | 5 ++--- .../texera/amber/engine/faulttolerance/LoggingSpec.scala | 4 ++++ .../texera/amber/engine/faulttolerance/ReplaySpec.scala | 4 ++++ .../core/storage/util/LakeFSStorageClientMtimeSpec.scala | 6 +----- .../org/apache/texera/amber/storage/FileResolverSpec.scala | 8 ++------ .../texera/service/util/LargeBinaryInputStreamSpec.scala | 7 +------ .../texera/service/util/LargeBinaryOutputStreamSpec.scala | 7 +------ .../org/apache/texera/service/util/S3StorageClientSpec.scala | 7 +------ .../operator/keywordSearch/KeywordSearchOpExecSpec.scala | 3 +-- .../amber/operator/source/fetcher/URLFetcherOpExecSpec.scala | 3 +-- .../amber/operator/typecasting/TypeCastingOpExecSpec.scala | 3 +-- .../visualization/ImageViz/ImageVisualizerOpDescSpec.scala | 6 +++--- .../ScatterMatrixChart/ScatterMatrixChartOpDescSpec.scala | 4 ++-- .../continuousErrorBands/ContinuousErrorBandsOpDescSpec.scala | 5 ++--- .../figureFactoryTable/FigureFactoryTableOpDescSpec.scala | 11 ++++------- .../visualization/histogram/HistogramChartOpDescSpec.scala | 2 +- .../operator/visualization/htmlviz/HtmlVizOpExecSpec.scala | 3 +-- .../visualization/nestedTable/NestedTableOpDescSpec.scala | 4 +--- .../visualization/tablesChart/TablesPlotOpDescSpec.scala | 4 ++-- .../ternaryContour/TernaryContourOpDescSpec.scala | 2 +- .../visualization/ternaryPlot/TernaryPlotOpDescSpec.scala | 2 +- .../waterfallChart/WaterfallChartOpDescSpec.scala | 7 ++----- .../visualization/windRoseChart/WindRoseChartOpDescSpec.scala | 5 ++--- 31 files changed, 49 insertions(+), 89 deletions(-) diff --git a/amber/src/test/integration/org/apache/texera/amber/storage/result/iceberg/IcebergDocumentConsoleMessagesSpec.scala b/amber/src/test/integration/org/apache/texera/amber/storage/result/iceberg/IcebergDocumentConsoleMessagesSpec.scala index a74d1f741a..1e7f1ea822 100644 --- a/amber/src/test/integration/org/apache/texera/amber/storage/result/iceberg/IcebergDocumentConsoleMessagesSpec.scala +++ b/amber/src/test/integration/org/apache/texera/amber/storage/result/iceberg/IcebergDocumentConsoleMessagesSpec.scala @@ -25,7 +25,6 @@ import org.apache.texera.amber.core.storage.{DocumentFactory, VFSURIFactory} import org.apache.texera.amber.core.tuple.{Schema, Tuple} import org.apache.texera.amber.core.virtualidentity._ import org.apache.texera.amber.tags.IntegrationTest -import org.scalatest.BeforeAndAfterAll import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers @@ -37,8 +36,7 @@ import scala.util.{Try, Using} class IcebergDocumentConsoleMessagesSpec extends AnyFlatSpec with Matchers - with VirtualDocumentSpec[Tuple] - with BeforeAndAfterAll { + with VirtualDocumentSpec[Tuple] { private val amberSchema: Schema = ResultSchema.consoleMessagesSchema var uri: URI = _ diff --git a/amber/src/test/scala/org/apache/texera/amber/engine/architecture/control/TrivialControlSpec.scala b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/control/TrivialControlSpec.scala index cb37ddf913..bf9b6cbd47 100644 --- a/amber/src/test/scala/org/apache/texera/amber/engine/architecture/control/TrivialControlSpec.scala +++ b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/control/TrivialControlSpec.scala @@ -42,7 +42,7 @@ import org.apache.texera.amber.engine.common.ambermessage.WorkflowMessage.getInM import org.apache.texera.amber.engine.common.rpc.AsyncRPCClient.ControlInvocation import org.apache.texera.amber.engine.common.virtualidentity.util.COORDINATOR import org.scalatest.wordspec.AnyWordSpecLike -import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} +import org.scalatest.BeforeAndAfterAll import scala.collection.mutable import scala.concurrent.duration._ @@ -50,7 +50,6 @@ import scala.concurrent.duration._ class TrivialControlSpec extends TestKit(ActorSystem("TrivialControlSpec")) with AnyWordSpecLike - with BeforeAndAfterEach with BeforeAndAfterAll { override def afterAll(): Unit = { diff --git a/amber/src/test/scala/org/apache/texera/amber/engine/architecture/messaginglayer/NetworkInputGatewaySpec.scala b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/messaginglayer/NetworkInputGatewaySpec.scala index 04f4f00045..6593b44b50 100644 --- a/amber/src/test/scala/org/apache/texera/amber/engine/architecture/messaginglayer/NetworkInputGatewaySpec.scala +++ b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/messaginglayer/NetworkInputGatewaySpec.scala @@ -22,10 +22,9 @@ package org.apache.texera.amber.engine.architecture.messaginglayer import org.apache.texera.amber.core.tuple.{AttributeType, Schema, TupleLike} import org.apache.texera.amber.core.virtualidentity.{ActorVirtualIdentity, ChannelIdentity} import org.apache.texera.amber.engine.common.ambermessage.{DataFrame, WorkflowFIFOMessage} -import org.scalamock.scalatest.MockFactory import org.scalatest.flatspec.AnyFlatSpec -class NetworkInputGatewaySpec extends AnyFlatSpec with MockFactory { +class NetworkInputGatewaySpec extends AnyFlatSpec { private val fakeReceiverID = ActorVirtualIdentity("testReceiver") private val fakeSenderID = ActorVirtualIdentity("testSender") diff --git a/amber/src/test/scala/org/apache/texera/amber/engine/architecture/messaginglayer/RangeBasedShuffleSpec.scala b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/messaginglayer/RangeBasedShuffleSpec.scala index 668b4fda99..424f34e79e 100644 --- a/amber/src/test/scala/org/apache/texera/amber/engine/architecture/messaginglayer/RangeBasedShuffleSpec.scala +++ b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/messaginglayer/RangeBasedShuffleSpec.scala @@ -23,10 +23,9 @@ import org.apache.texera.amber.core.tuple.{Attribute, AttributeType, Schema, Tup import org.apache.texera.amber.core.virtualidentity.{ActorVirtualIdentity, ChannelIdentity} import org.apache.texera.amber.engine.architecture.sendsemantics.partitioners.RangeBasedShufflePartitioner import org.apache.texera.amber.engine.architecture.sendsemantics.partitionings.RangeBasedShufflePartitioning -import org.scalamock.scalatest.MockFactory import org.scalatest.flatspec.AnyFlatSpec -class RangeBasedShuffleSpec extends AnyFlatSpec with MockFactory { +class RangeBasedShuffleSpec extends AnyFlatSpec { val identifier = ActorVirtualIdentity("batch producer mock") val fakeID1: ActorVirtualIdentity = ActorVirtualIdentity("rec1") val fakeID2: ActorVirtualIdentity = ActorVirtualIdentity("rec2") diff --git a/amber/src/test/scala/org/apache/texera/amber/engine/architecture/scheduling/CostBasedScheduleGeneratorSpec.scala b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/scheduling/CostBasedScheduleGeneratorSpec.scala index 0b4aabe3b1..40b891474a 100644 --- a/amber/src/test/scala/org/apache/texera/amber/engine/architecture/scheduling/CostBasedScheduleGeneratorSpec.scala +++ b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/scheduling/CostBasedScheduleGeneratorSpec.scala @@ -30,12 +30,11 @@ import org.apache.texera.amber.engine.common.virtualidentity.util.COORDINATOR import org.apache.texera.amber.engine.e2e.TestUtils.buildWorkflow import org.apache.texera.amber.operator.TestOperators import org.apache.texera.common.compiler.model.LogicalLink -import org.scalamock.scalatest.MockFactory import org.scalatest.flatspec.AnyFlatSpec import scala.jdk.CollectionConverters._ -class CostBasedScheduleGeneratorSpec extends AnyFlatSpec with MockFactory { +class CostBasedScheduleGeneratorSpec extends AnyFlatSpec { "CostBasedRegionPlanGenerator" should "finish bottom-up search using different pruning techniques with correct number of states explored in csv->->filter->join->filter2 workflow" in { val headerlessCsvOpDesc1 = TestOperators.headerlessSmallCsvScanOpDesc() diff --git a/amber/src/test/scala/org/apache/texera/amber/engine/architecture/scheduling/DefaultCostEstimatorSpec.scala b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/scheduling/DefaultCostEstimatorSpec.scala index c3438d5d38..dc1949741c 100644 --- a/amber/src/test/scala/org/apache/texera/amber/engine/architecture/scheduling/DefaultCostEstimatorSpec.scala +++ b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/scheduling/DefaultCostEstimatorSpec.scala @@ -40,7 +40,7 @@ import org.apache.texera.dao.MockTexeraDB import org.apache.texera.dao.jooq.generated.enums.UserRoleEnum import org.apache.texera.web.ExecutionDatabaseTestSupport import org.scalatest.flatspec.AnyFlatSpec -import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} +import org.scalatest.BeforeAndAfterEach import java.net.URI import java.sql.Timestamp @@ -48,7 +48,6 @@ import scala.jdk.CollectionConverters.CollectionHasAsScala class DefaultCostEstimatorSpec extends AnyFlatSpec - with BeforeAndAfterAll with BeforeAndAfterEach with MockTexeraDB with ExecutionDatabaseTestSupport { diff --git a/amber/src/test/scala/org/apache/texera/amber/engine/architecture/worker/DataProcessorSpec.scala b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/worker/DataProcessorSpec.scala index c48e959420..33129ffe0e 100644 --- a/amber/src/test/scala/org/apache/texera/amber/engine/architecture/worker/DataProcessorSpec.scala +++ b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/worker/DataProcessorSpec.scala @@ -62,14 +62,13 @@ import org.apache.texera.amber.engine.common.virtualidentity.util.COORDINATOR import org.apache.texera.amber.util.JSONUtils.objectMapper import org.apache.texera.amber.util.VirtualIdentityUtils import org.scalamock.scalatest.MockFactory -import org.scalatest.BeforeAndAfterEach import org.scalatest.flatspec.AnyFlatSpec import org.scalatest.matchers.should.Matchers import java.util.concurrent.LinkedBlockingQueue import scala.collection.mutable.ArrayBuffer -class DataProcessorSpec extends AnyFlatSpec with MockFactory with Matchers with BeforeAndAfterEach { +class DataProcessorSpec extends AnyFlatSpec with MockFactory with Matchers { import DataProcessorSpec._ diff --git a/amber/src/test/scala/org/apache/texera/amber/engine/architecture/worker/WorkerSpec.scala b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/worker/WorkerSpec.scala index 96929eab9a..81d71cc0bb 100644 --- a/amber/src/test/scala/org/apache/texera/amber/engine/architecture/worker/WorkerSpec.scala +++ b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/worker/WorkerSpec.scala @@ -49,7 +49,6 @@ import org.apache.texera.amber.engine.common.ambermessage.{ } import org.apache.texera.amber.engine.common.rpc.AsyncRPCClient import org.apache.texera.amber.engine.common.virtualidentity.util.COORDINATOR -import org.scalamock.scalatest.MockFactory import org.scalatest.BeforeAndAfterAll import org.scalatest.flatspec.AnyFlatSpecLike @@ -67,8 +66,7 @@ class WorkerSpec extends TestKit(ActorSystem("WorkerSpec", AmberRuntime.pekkoConfig)) with ImplicitSender with AnyFlatSpecLike - with BeforeAndAfterAll - with MockFactory { + with BeforeAndAfterAll { def mkSchema(fields: Any*): Schema = { var schema = Schema() diff --git a/amber/src/test/scala/org/apache/texera/amber/engine/e2e/BatchSizePropagationSpec.scala b/amber/src/test/scala/org/apache/texera/amber/engine/e2e/BatchSizePropagationSpec.scala index 8e2a804b0f..968a1dcb53 100644 --- a/amber/src/test/scala/org/apache/texera/amber/engine/e2e/BatchSizePropagationSpec.scala +++ b/amber/src/test/scala/org/apache/texera/amber/engine/e2e/BatchSizePropagationSpec.scala @@ -32,7 +32,7 @@ import org.apache.texera.amber.operator.{LogicalOp, TestOperators} import org.apache.texera.amber.operator.aggregate.AggregationFunction import org.apache.texera.common.compiler.model.LogicalLink import org.scalatest.flatspec.AnyFlatSpecLike -import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} +import org.scalatest.BeforeAndAfterAll import scala.concurrent.duration.DurationInt @@ -40,8 +40,7 @@ class BatchSizePropagationSpec extends TestKit(ActorSystem("BatchSizePropagationSpec")) with ImplicitSender with AnyFlatSpecLike - with BeforeAndAfterAll - with BeforeAndAfterEach { + with BeforeAndAfterAll { implicit val timeout: Timeout = Timeout(5.seconds) diff --git a/amber/src/test/scala/org/apache/texera/amber/engine/faulttolerance/LoggingSpec.scala b/amber/src/test/scala/org/apache/texera/amber/engine/faulttolerance/LoggingSpec.scala index e090642f3c..b1756ad68a 100644 --- a/amber/src/test/scala/org/apache/texera/amber/engine/faulttolerance/LoggingSpec.scala +++ b/amber/src/test/scala/org/apache/texera/amber/engine/faulttolerance/LoggingSpec.scala @@ -67,6 +67,10 @@ class LoggingSpec with BeforeAndAfterAll with TimeLimitedTests { + override def afterAll(): Unit = { + TestKit.shutdownActorSystem(system) + } + private val identifier1 = ActorVirtualIdentity("Worker:WF1-E1-op-layer-1") private val identifier2 = ActorVirtualIdentity("Worker:WF1-E1-op-layer-2") private val operatorIdentity = OperatorIdentity("testOperator") diff --git a/amber/src/test/scala/org/apache/texera/amber/engine/faulttolerance/ReplaySpec.scala b/amber/src/test/scala/org/apache/texera/amber/engine/faulttolerance/ReplaySpec.scala index 3fa198fb05..e178aa3a34 100644 --- a/amber/src/test/scala/org/apache/texera/amber/engine/faulttolerance/ReplaySpec.scala +++ b/amber/src/test/scala/org/apache/texera/amber/engine/faulttolerance/ReplaySpec.scala @@ -50,6 +50,10 @@ class ReplaySpec with AnyFlatSpecLike with BeforeAndAfterAll { + override def afterAll(): Unit = { + TestKit.shutdownActorSystem(system) + } + class IterableReadOnlyLogStore(iter: Iterable[ReplayLogRecord]) extends SequentialRecordStorage[ReplayLogRecord] { override def getWriter( diff --git a/common/workflow-core/src/test/scala/org/apache/texera/amber/core/storage/util/LakeFSStorageClientMtimeSpec.scala b/common/workflow-core/src/test/scala/org/apache/texera/amber/core/storage/util/LakeFSStorageClientMtimeSpec.scala index 88076d807c..2fc1b682d4 100644 --- a/common/workflow-core/src/test/scala/org/apache/texera/amber/core/storage/util/LakeFSStorageClientMtimeSpec.scala +++ b/common/workflow-core/src/test/scala/org/apache/texera/amber/core/storage/util/LakeFSStorageClientMtimeSpec.scala @@ -57,11 +57,7 @@ import java.nio.charset.StandardCharsets * whichever suite ran second talk to the other one's server. */ @NonParallelTest -class LakeFSStorageClientMtimeSpec - extends AnyFlatSpec - with Matchers - with ForAllTestContainer - with org.scalatest.BeforeAndAfterAll { +class LakeFSStorageClientMtimeSpec extends AnyFlatSpec with Matchers with ForAllTestContainer { // Shared network so LakeFS can reach Postgres and RustFS by their in-network aliases while // the test reaches LakeFS/RustFS via mapped host ports. diff --git a/common/workflow-core/src/test/scala/org/apache/texera/amber/storage/FileResolverSpec.scala b/common/workflow-core/src/test/scala/org/apache/texera/amber/storage/FileResolverSpec.scala index 2d7f06b900..2b3783af7f 100644 --- a/common/workflow-core/src/test/scala/org/apache/texera/amber/storage/FileResolverSpec.scala +++ b/common/workflow-core/src/test/scala/org/apache/texera/amber/storage/FileResolverSpec.scala @@ -42,15 +42,11 @@ import org.apache.texera.dao.jooq.generated.tables.pojos.{ User } import org.scalatest.flatspec.AnyFlatSpec -import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} +import org.scalatest.BeforeAndAfterAll import java.nio.file.Paths -class FileResolverSpec - extends AnyFlatSpec - with BeforeAndAfterAll - with BeforeAndAfterEach - with MockTexeraDB { +class FileResolverSpec extends AnyFlatSpec with BeforeAndAfterAll with MockTexeraDB { private val testUser: User = { val user = new User diff --git a/common/workflow-core/src/test/scala/org/apache/texera/service/util/LargeBinaryInputStreamSpec.scala b/common/workflow-core/src/test/scala/org/apache/texera/service/util/LargeBinaryInputStreamSpec.scala index 21b6e8c29b..5bdba17f56 100644 --- a/common/workflow-core/src/test/scala/org/apache/texera/service/util/LargeBinaryInputStreamSpec.scala +++ b/common/workflow-core/src/test/scala/org/apache/texera/service/util/LargeBinaryInputStreamSpec.scala @@ -21,18 +21,13 @@ package org.apache.texera.service.util import org.apache.texera.amber.core.tuple.LargeBinary import org.apache.texera.common.tags.NonParallelTest -import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} import org.scalatest.funsuite.AnyFunSuite import java.io.{ByteArrayInputStream, IOException} import scala.util.Random @NonParallelTest -class LargeBinaryInputStreamSpec - extends AnyFunSuite - with S3StorageTestBase - with BeforeAndAfterAll - with BeforeAndAfterEach { +class LargeBinaryInputStreamSpec extends AnyFunSuite with S3StorageTestBase { private val testBucketName = "test-large-binary-input-stream" diff --git a/common/workflow-core/src/test/scala/org/apache/texera/service/util/LargeBinaryOutputStreamSpec.scala b/common/workflow-core/src/test/scala/org/apache/texera/service/util/LargeBinaryOutputStreamSpec.scala index 35e7595013..3c87be4330 100644 --- a/common/workflow-core/src/test/scala/org/apache/texera/service/util/LargeBinaryOutputStreamSpec.scala +++ b/common/workflow-core/src/test/scala/org/apache/texera/service/util/LargeBinaryOutputStreamSpec.scala @@ -21,18 +21,13 @@ package org.apache.texera.service.util import org.apache.texera.amber.core.tuple.LargeBinary import org.apache.texera.common.tags.NonParallelTest -import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} import org.scalatest.funsuite.AnyFunSuite import java.io.IOException import scala.util.Random @NonParallelTest -class LargeBinaryOutputStreamSpec - extends AnyFunSuite - with S3StorageTestBase - with BeforeAndAfterAll - with BeforeAndAfterEach { +class LargeBinaryOutputStreamSpec extends AnyFunSuite with S3StorageTestBase { private val testBucketName = "test-large-binary-output-stream" diff --git a/common/workflow-core/src/test/scala/org/apache/texera/service/util/S3StorageClientSpec.scala b/common/workflow-core/src/test/scala/org/apache/texera/service/util/S3StorageClientSpec.scala index 1e910a46b6..9e2c068f0d 100644 --- a/common/workflow-core/src/test/scala/org/apache/texera/service/util/S3StorageClientSpec.scala +++ b/common/workflow-core/src/test/scala/org/apache/texera/service/util/S3StorageClientSpec.scala @@ -21,7 +21,6 @@ package org.apache.texera.service.util import org.apache.texera.common.config.StorageConfig import org.apache.texera.common.tags.NonParallelTest -import org.scalatest.{BeforeAndAfterAll, BeforeAndAfterEach} import org.scalatest.funsuite.AnyFunSuite import software.amazon.awssdk.auth.credentials.{AwsBasicCredentials, StaticCredentialsProvider} import software.amazon.awssdk.regions.Region @@ -36,11 +35,7 @@ import scala.jdk.CollectionConverters._ import scala.util.Random @NonParallelTest -class S3StorageClientSpec - extends AnyFunSuite - with S3StorageTestBase - with BeforeAndAfterAll - with BeforeAndAfterEach { +class S3StorageClientSpec extends AnyFunSuite with S3StorageTestBase { private val testBucketName = "test-s3-storage-client" diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/keywordSearch/KeywordSearchOpExecSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/keywordSearch/KeywordSearchOpExecSpec.scala index d035a3da7b..b3addf36ff 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/keywordSearch/KeywordSearchOpExecSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/keywordSearch/KeywordSearchOpExecSpec.scala @@ -21,10 +21,9 @@ package org.apache.texera.amber.operator.keywordSearch import org.apache.texera.amber.core.tuple.{Attribute, AttributeType, Schema, Tuple} import org.apache.texera.amber.util.JSONUtils.objectMapper -import org.scalatest.BeforeAndAfter import org.scalatest.flatspec.AnyFlatSpec -class KeywordSearchOpExecSpec extends AnyFlatSpec with BeforeAndAfter { +class KeywordSearchOpExecSpec extends AnyFlatSpec { val inputPort: Int = 0 val opDesc: KeywordSearchOpDesc = new KeywordSearchOpDesc() diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/source/fetcher/URLFetcherOpExecSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/source/fetcher/URLFetcherOpExecSpec.scala index a1a3967d65..e6dbf90296 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/source/fetcher/URLFetcherOpExecSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/source/fetcher/URLFetcherOpExecSpec.scala @@ -20,9 +20,8 @@ package org.apache.texera.amber.operator.source.fetcher import org.apache.texera.amber.util.JSONUtils.objectMapper -import org.scalatest.BeforeAndAfter import org.scalatest.flatspec.AnyFlatSpec -class URLFetcherOpExecSpec extends AnyFlatSpec with BeforeAndAfter { +class URLFetcherOpExecSpec extends AnyFlatSpec { val opDesc: URLFetcherOpDesc = new URLFetcherOpDesc() diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/typecasting/TypeCastingOpExecSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/typecasting/TypeCastingOpExecSpec.scala index 02b710a849..071b5520af 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/typecasting/TypeCastingOpExecSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/typecasting/TypeCastingOpExecSpec.scala @@ -21,9 +21,8 @@ package org.apache.texera.amber.operator.typecasting import org.apache.texera.amber.core.tuple._ import org.apache.texera.amber.util.JSONUtils.objectMapper -import org.scalatest.BeforeAndAfter import org.scalatest.flatspec.AnyFlatSpec -class TypeCastingOpExecSpec extends AnyFlatSpec with BeforeAndAfter { +class TypeCastingOpExecSpec extends AnyFlatSpec { val tupleSchema: Schema = Schema() .add(new Attribute("field1", AttributeType.STRING)) .add(new Attribute("field2", AttributeType.INTEGER)) diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ImageViz/ImageVisualizerOpDescSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ImageViz/ImageVisualizerOpDescSpec.scala index 71c90f83bc..08c8930773 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ImageViz/ImageVisualizerOpDescSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ImageViz/ImageVisualizerOpDescSpec.scala @@ -40,13 +40,13 @@ class ImageVisualizerOpDescSpec // operator reaches the nonEmpty assert and surfaces a domain error with // the standard "cannot be empty" message rather than a // NullPointerException from dereferencing null. - val ex = expectError[AssertionError]("cannot be empty")(opDesc.createBinaryData()) + expectError[AssertionError]("cannot be empty")(opDesc.createBinaryData()) } it should "reject missing binaryContent with a controlled error via generatePythonCode" in { // The assert inside createBinaryData is also reachable through the // public codegen entry point; the same message must surface there. - val ex = expectError[AssertionError]("cannot be empty")(opDesc.generatePythonCode()) + expectError[AssertionError]("cannot be empty")(opDesc.generatePythonCode()) } "ImageVisualizerOpDesc.operatorInfo" should "advertise the user-friendly name and Media group" in { @@ -76,7 +76,7 @@ class ImageVisualizerOpDescSpec // the nonEmpty assert, whose message must end with the standard // "cannot be empty" phrase. opDesc.binaryContent = "" - val ex = expectError[AssertionError]("cannot be empty")(opDesc.createBinaryData()) + expectError[AssertionError]("cannot be empty")(opDesc.createBinaryData()) } it should "render the configured binary content column in createBinaryData" in { diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ScatterMatrixChart/ScatterMatrixChartOpDescSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ScatterMatrixChart/ScatterMatrixChartOpDescSpec.scala index 747f358676..4a0947d641 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ScatterMatrixChart/ScatterMatrixChartOpDescSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ScatterMatrixChart/ScatterMatrixChartOpDescSpec.scala @@ -37,12 +37,12 @@ class ScatterMatrixChartOpDescSpec it should "throw AssertionError with a 'cannot be empty' message when selected attributes are left at their default" in { // selectedAttributes now defaults to List() and the assert is null-safe, // so an unconfigured operator hits the assert (never an NPE). - val ex = expectError[AssertionError]("cannot be empty")(opDesc.createPlotlyFigure()) + expectError[AssertionError]("cannot be empty")(opDesc.createPlotlyFigure()) } it should "throw AssertionError with a 'cannot be empty' message when selected attributes list is explicitly empty" in { opDesc.selectedAttributes = List() - val ex = expectError[AssertionError]("cannot be empty")(opDesc.createPlotlyFigure()) + expectError[AssertionError]("cannot be empty")(opDesc.createPlotlyFigure()) } it should "render selected attributes and the color column when configured" in { diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/continuousErrorBands/ContinuousErrorBandsOpDescSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/continuousErrorBands/ContinuousErrorBandsOpDescSpec.scala index 1d0a9c01be..ece0503271 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/continuousErrorBands/ContinuousErrorBandsOpDescSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/continuousErrorBands/ContinuousErrorBandsOpDescSpec.scala @@ -51,12 +51,11 @@ class ContinuousErrorBandsOpDescSpec } it should "throw an AssertionError (not a NullPointerException) when bands is left empty (createPlotlyFigure)" in { - val ex = expectError[AssertionError]("Bands cannot be empty")(opDesc.createPlotlyFigure()) - ex shouldBe a[AssertionError] + expectError[AssertionError]("Bands cannot be empty")(opDesc.createPlotlyFigure()) } it should "throw an AssertionError naming the Bands when generating python code with an empty bands list" in { - val ex = expectError[AssertionError]("Bands cannot be empty")(opDesc.generatePythonCode()) + expectError[AssertionError]("Bands cannot be empty")(opDesc.generatePythonCode()) } it should "render the configured band columns when the bands list is set" in { diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/figureFactoryTable/FigureFactoryTableOpDescSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/figureFactoryTable/FigureFactoryTableOpDescSpec.scala index 1d1123ee6c..8b9e7d6092 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/figureFactoryTable/FigureFactoryTableOpDescSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/figureFactoryTable/FigureFactoryTableOpDescSpec.scala @@ -50,26 +50,23 @@ class FigureFactoryTableOpDescSpec opDesc.columns = List(column("col_one"), column("col_two")) it should "throw AssertionError with a 'cannot be empty' message when columns list is empty (manipulateTable)" in { - val ex = expectError[AssertionError]("cannot be empty")(opDesc.manipulateTable()) + expectError[AssertionError]("cannot be empty")(opDesc.manipulateTable()) } it should "throw AssertionError with a 'cannot be empty' message when columns list is empty (createFigureFactoryTablePlotlyFigure)" in { - val ex = - expectError[AssertionError]("cannot be empty")(opDesc.createFigureFactoryTablePlotlyFigure()) + expectError[AssertionError]("cannot be empty")(opDesc.createFigureFactoryTablePlotlyFigure()) } it should "throw AssertionError mentioning 'at least 30' when rowHeight is below 30" in { withColumns() opDesc.rowHeight = 10.0 - val ex = - expectError[AssertionError]("at least 30")(opDesc.createFigureFactoryTablePlotlyFigure()) + expectError[AssertionError]("at least 30")(opDesc.createFigureFactoryTablePlotlyFigure()) } it should "throw AssertionError mentioning 'non-negative' when fontSize is negative" in { withColumns() opDesc.fontSize = -1.0 - val ex = - expectError[AssertionError]("non-negative")(opDesc.createFigureFactoryTablePlotlyFigure()) + expectError[AssertionError]("non-negative")(opDesc.createFigureFactoryTablePlotlyFigure()) } it should "not throw with default fontSize (12) and rowHeight (30) once columns are set" in { diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/histogram/HistogramChartOpDescSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/histogram/HistogramChartOpDescSpec.scala index c17d4785c0..d73ab8bccd 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/histogram/HistogramChartOpDescSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/histogram/HistogramChartOpDescSpec.scala @@ -45,7 +45,7 @@ class HistogramChartOpDescSpec } it should "throw AssertionError with a non-blank message via generatePythonCode when value is empty" in { - val ex = expectError[AssertionError]("cannot be empty")(opDesc.generatePythonCode()) + expectError[AssertionError]("cannot be empty")(opDesc.generatePythonCode()) } it should "render the figure with the configured value column when value is set" in { diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/htmlviz/HtmlVizOpExecSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/htmlviz/HtmlVizOpExecSpec.scala index 078b19b426..3921b6f4cf 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/htmlviz/HtmlVizOpExecSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/htmlviz/HtmlVizOpExecSpec.scala @@ -22,9 +22,8 @@ package org.apache.texera.amber.operator.visualization.htmlviz import org.apache.texera.amber.core.tuple._ import org.apache.texera.amber.core.workflow.PortIdentity import org.apache.texera.amber.util.JSONUtils.objectMapper -import org.scalatest.BeforeAndAfter import org.scalatest.flatspec.AnyFlatSpec -class HtmlVizOpExecSpec extends AnyFlatSpec with BeforeAndAfter { +class HtmlVizOpExecSpec extends AnyFlatSpec { val schema = new Schema( new Attribute("field1", AttributeType.STRING), new Attribute("field2", AttributeType.STRING) diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/nestedTable/NestedTableOpDescSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/nestedTable/NestedTableOpDescSpec.scala index b0530dc820..15f8f27c29 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/nestedTable/NestedTableOpDescSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/nestedTable/NestedTableOpDescSpec.scala @@ -49,9 +49,7 @@ class NestedTableOpDescSpec } it should "throw an AssertionError (not a NullPointerException) when includedColumns is left empty" in { - val ex = - expectError[AssertionError]("Included Columns cannot be empty")(opDesc.generatePythonCode()) - ex shouldBe a[AssertionError] + expectError[AssertionError]("Included Columns cannot be empty")(opDesc.generatePythonCode()) } it should "generate python code carrying the configured columns when includedColumns is set" in { diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/tablesChart/TablesPlotOpDescSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/tablesChart/TablesPlotOpDescSpec.scala index 492880d7c9..e2474cc07b 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/tablesChart/TablesPlotOpDescSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/tablesChart/TablesPlotOpDescSpec.scala @@ -47,11 +47,11 @@ class TablesPlotOpDescSpec } it should "throw AssertionError with a 'cannot be empty' message when included columns list is empty (manipulateTable)" in { - val ex = expectError[AssertionError]("cannot be empty")(opDesc.manipulateTable()) + expectError[AssertionError]("cannot be empty")(opDesc.manipulateTable()) } it should "throw AssertionError with a 'cannot be empty' message when included columns list is empty (createPlotlyFigure)" in { - val ex = expectError[AssertionError]("cannot be empty")(opDesc.createPlotlyFigure()) + expectError[AssertionError]("cannot be empty")(opDesc.createPlotlyFigure()) } it should "render the configured columns when the included columns list is set" in { diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ternaryContour/TernaryContourOpDescSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ternaryContour/TernaryContourOpDescSpec.scala index 7409b4c757..6e6c3357c1 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ternaryContour/TernaryContourOpDescSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ternaryContour/TernaryContourOpDescSpec.scala @@ -35,7 +35,7 @@ class TernaryContourOpDescSpec } it should "throw AssertionError with a 'cannot be empty' message when all variables are empty" in { - val ex = expectError[AssertionError]("cannot be empty")(opDesc.manipulateTable()) + expectError[AssertionError]("cannot be empty")(opDesc.manipulateTable()) } // The compound assert over the four variables is split per-field; diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ternaryPlot/TernaryPlotOpDescSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ternaryPlot/TernaryPlotOpDescSpec.scala index 68a396cc11..d544e6d746 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ternaryPlot/TernaryPlotOpDescSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/ternaryPlot/TernaryPlotOpDescSpec.scala @@ -35,7 +35,7 @@ class TernaryPlotOpDescSpec } it should "throw AssertionError with a 'cannot be empty' message when all variables are empty" in { - val ex = expectError[AssertionError]("cannot be empty")(opDesc.manipulateTable()) + expectError[AssertionError]("cannot be empty")(opDesc.manipulateTable()) } // The compound assert over the three variables is being split per-field; diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/waterfallChart/WaterfallChartOpDescSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/waterfallChart/WaterfallChartOpDescSpec.scala index 50d88ceeb8..d93393508f 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/waterfallChart/WaterfallChartOpDescSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/waterfallChart/WaterfallChartOpDescSpec.scala @@ -48,15 +48,12 @@ class WaterfallChartOpDescSpec } it should "throw an AssertionError (not a NullPointerException) naming the X Axis when xColumn is left empty" in { - val ex = - expectError[AssertionError]("X Axis Values cannot be empty")(opDesc.createPlotlyFigure()) - ex shouldBe a[AssertionError] + expectError[AssertionError]("X Axis Values cannot be empty")(opDesc.createPlotlyFigure()) } it should "throw an AssertionError naming the Y Axis when only xColumn is set" in { opDesc.xColumn = "x_col" - val ex = - expectError[AssertionError]("Y Axis Values cannot be empty")(opDesc.createPlotlyFigure()) + expectError[AssertionError]("Y Axis Values cannot be empty")(opDesc.createPlotlyFigure()) } it should "render the configured x and y columns when both are set" in { diff --git a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/windRoseChart/WindRoseChartOpDescSpec.scala b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/windRoseChart/WindRoseChartOpDescSpec.scala index 118bdff80d..17a8c8dd2c 100644 --- a/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/windRoseChart/WindRoseChartOpDescSpec.scala +++ b/common/workflow-operator/src/test/scala/org/apache/texera/amber/operator/visualization/windRoseChart/WindRoseChartOpDescSpec.scala @@ -45,15 +45,14 @@ class WindRoseChartOpDescSpec } it should "throw an AssertionError (not a NullPointerException) naming the Radial column when rColumn is empty" in { - val ex = expectError[AssertionError]("Radial Values (r) column must be selected.")( + expectError[AssertionError]("Radial Values (r) column must be selected.")( opDesc.createPlotlyFigure() ) - ex shouldBe a[AssertionError] } it should "throw an AssertionError naming the Angular column when only rColumn is set" in { opDesc.rColumn = "r_col" - val ex = expectError[AssertionError]("Angular Values (θ) column must be selected.")( + expectError[AssertionError]("Angular Values (θ) column must be selected.")( opDesc.createPlotlyFigure() ) }
