Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 = _
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ 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._

class TrivialControlSpec
extends TestKit(ActorSystem("TrivialControlSpec"))
with AnyWordSpecLike
with BeforeAndAfterEach
with BeforeAndAfterAll {

override def afterAll(): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Comment thread
aglinxinyuan marked this conversation as resolved.
Resolved

private val fakeReceiverID = ActorVirtualIdentity("testReceiver")
private val fakeSenderID = ActorVirtualIdentity("testSender")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@ 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
import scala.jdk.CollectionConverters.CollectionHasAsScala

class DefaultCostEstimatorSpec
extends AnyFlatSpec
with BeforeAndAfterAll
with BeforeAndAfterEach
with MockTexeraDB
with ExecutionDatabaseTestSupport {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,15 @@ 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

class BatchSizePropagationSpec
extends TestKit(ActorSystem("BatchSizePropagationSpec"))
with ImplicitSender
with AnyFlatSpecLike
with BeforeAndAfterAll
with BeforeAndAfterEach {
with BeforeAndAfterAll {

implicit val timeout: Timeout = Timeout(5.seconds)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading
Loading