trait TestcontainersKafkaLike extends KafkaSpec with Spec
Uses Testcontainers to start a Kafka cluster in a Docker container. This trait will start Kafka only once per test session. To create a Kafka cluster per test class see TestcontainersKafkaPerClassLike.
The Testcontainers dependency has to be added explicitly.
- Alphabetic
- By Inheritance
- TestcontainersKafkaLike
- Spec
- KafkaSpec
- KafkaTestKit
- TestKit
- TestKitBase
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val DefaultKey: String
- Definition Classes
- KafkaTestKit
- val StringDeserializer: StringDeserializer
- Definition Classes
- KafkaTestKit
- val StringSerializer: StringSerializer
- Definition Classes
- KafkaTestKit
- implicit val adapter: LoggingAdapter
- Definition Classes
- KafkaSpec
- def adminClient: Admin
Access to the Kafka Admin client
Access to the Kafka Admin client
- Definition Classes
- KafkaTestKit
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def assertForDuration[A](a: => A, max: FiniteDuration, interval: Duration): A
- Definition Classes
- TestKitBase
- def awaitAssert[A](a: => A, max: Duration, interval: Duration): A
- Definition Classes
- TestKitBase
- def awaitCond(p: => Boolean, max: Duration, interval: Duration, message: String): Unit
- Definition Classes
- TestKitBase
- def awaitMultiple[T](d: FiniteDuration, futures: Future[T]*): Seq[T]
- Definition Classes
- KafkaSpec
- def awaitProduce(futures: Future[Done]*): Unit
- Definition Classes
- KafkaSpec
- def batchMessagesExpected(topics: Seq[String], batches: Int, batchSize: Int): (Seq[String], Long)
Messages expected from #produceBatches generation.
Messages expected from #produceBatches generation.
- Definition Classes
- KafkaSpec
- def bootstrapServers: String
- Definition Classes
- TestcontainersKafkaLike → Spec → KafkaTestKit
- def brokerContainers: Vector[AlpakkaKafkaContainer]
- Definition Classes
- TestcontainersKafkaLike → Spec
- def childActorOf(props: Props): ActorRef
- Definition Classes
- TestKitBase
- def childActorOf(props: Props, name: String): ActorRef
- Definition Classes
- TestKitBase
- def childActorOf(props: Props, supervisorStrategy: SupervisorStrategy): ActorRef
- Definition Classes
- TestKitBase
- def childActorOf(props: Props, name: String, supervisorStrategy: SupervisorStrategy): ActorRef
- Definition Classes
- TestKitBase
- def cleanUp(): Unit
- Definition Classes
- TestcontainersKafkaLike → KafkaSpec
- def cleanUpAdminClient(): Unit
Close internal admin client instances.
Close internal admin client instances.
- Definition Classes
- KafkaTestKit
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def committerDefaults: CommitterSettings
- Definition Classes
- KafkaTestKit
- def consumerDefaults[K, V](keyDeserializer: Deserializer[K], valueDeserializer: Deserializer[V]): ConsumerSettings[K, V]
- Definition Classes
- KafkaTestKit
- def consumerDefaults: ConsumerSettings[String, String]
- Definition Classes
- KafkaTestKit
- def createGroupId(suffix: Int): String
Return a unique group id with a given suffix.
Return a unique group id with a given suffix.
- Definition Classes
- KafkaTestKit
- def createGroupId(): String
Return a unique group id with a default suffix.
Return a unique group id with a default suffix.
- Definition Classes
- KafkaTestKit
- def createProbe(consumerSettings: ConsumerSettings[String, String], topic: String*): (Control, Probe[String])
- Definition Classes
- KafkaSpec
- def createTopic(suffix: Int, partitions: Int, replication: Int, config: Map[String, String]): String
Java Api
Java Api
Create a topic with given suffix, partition number, replication factor, and topic configuration.
This method will block and return only when the topic has been successfully created.
- Definition Classes
- KafkaTestKit
- def createTopic(suffix: Int, partitions: Int, replication: Int, config: Map[String, String]): String
Create a topic with given suffix, partition number, replication factor, and topic configuration.
Create a topic with given suffix, partition number, replication factor, and topic configuration.
This method will block and return only when the topic has been successfully created.
- Definition Classes
- KafkaTestKit
- def createTopic(suffix: Int, partitions: Int, replication: Int): String
Create a topic with given suffix, partition number, replication factor, and no topic configuration.
Create a topic with given suffix, partition number, replication factor, and no topic configuration.
This method will block and return only when the topic has been successfully created.
- Definition Classes
- KafkaTestKit
- def createTopic(suffix: Int, partitions: Int): String
Create a topic with a given suffix, partition number, a replication factor of one, and no topic configuration.
Create a topic with a given suffix, partition number, a replication factor of one, and no topic configuration.
This method will block and return only when the topic has been successfully created.
- Definition Classes
- KafkaTestKit
- def createTopic(suffix: Int): String
Create a topic with a given suffix, single partitions, a replication factor of one, and no topic configuration.
Create a topic with a given suffix, single partitions, a replication factor of one, and no topic configuration.
This method will block and return only when the topic has been successfully created.
- Definition Classes
- KafkaTestKit
- def createTopic(): String
Create a topic with a default suffix, single partition, a replication factor of one, and no topic configuration.
Create a topic with a default suffix, single partition, a replication factor of one, and no topic configuration.
This method will block and return only when the topic has been successfully created.
- Definition Classes
- KafkaTestKit
- def createTopicName(suffix: Int): String
Return a unique topic name.
Return a unique topic name.
- Definition Classes
- KafkaTestKit
- def createTopics(topics: Int*): Seq[String]
- Definition Classes
- KafkaSpec
- implicit val ec: ExecutionContext
- Definition Classes
- KafkaSpec
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def expectMsg[T](max: FiniteDuration, hint: String, obj: T): T
- Definition Classes
- TestKitBase
- def expectMsg[T](max: FiniteDuration, obj: T): T
- Definition Classes
- TestKitBase
- def expectMsg[T](obj: T): T
- Definition Classes
- TestKitBase
- def expectMsgAllClassOf[T](max: FiniteDuration, obj: Class[_ <: T]*): Seq[T]
- Definition Classes
- TestKitBase
- def expectMsgAllClassOf[T](obj: Class[_ <: T]*): Seq[T]
- Definition Classes
- TestKitBase
- def expectMsgAllConformingOf[T](max: FiniteDuration, obj: Class[_ <: T]*): Seq[T]
- Definition Classes
- TestKitBase
- def expectMsgAllConformingOf[T](obj: Class[_ <: T]*): Seq[T]
- Definition Classes
- TestKitBase
- def expectMsgAllOf[T](max: FiniteDuration, obj: T*): Seq[T]
- Definition Classes
- TestKitBase
- def expectMsgAllOf[T](obj: T*): Seq[T]
- Definition Classes
- TestKitBase
- def expectMsgAnyClassOf[C](max: FiniteDuration, obj: Class[_ <: C]*): C
- Definition Classes
- TestKitBase
- def expectMsgAnyClassOf[C](obj: Class[_ <: C]*): C
- Definition Classes
- TestKitBase
- def expectMsgAnyOf[T](max: FiniteDuration, obj: T*): T
- Definition Classes
- TestKitBase
- def expectMsgAnyOf[T](obj: T*): T
- Definition Classes
- TestKitBase
- def expectMsgClass[C](max: FiniteDuration, c: Class[C]): C
- Definition Classes
- TestKitBase
- def expectMsgClass[C](c: Class[C]): C
- Definition Classes
- TestKitBase
- def expectMsgPF[T](max: Duration, hint: String)(f: PartialFunction[Any, T]): T
- Definition Classes
- TestKitBase
- def expectMsgType[T](max: FiniteDuration)(implicit t: ClassTag[T]): T
- Definition Classes
- TestKitBase
- def expectMsgType[T](implicit t: ClassTag[T]): T
- Definition Classes
- TestKitBase
- def expectNoMessage(): Unit
- Definition Classes
- TestKitBase
- def expectNoMessage(max: FiniteDuration): Unit
- Definition Classes
- TestKitBase
- def expectTerminated(target: ActorRef, max: Duration): Terminated
- Definition Classes
- TestKitBase
- def fishForMessage(max: Duration, hint: String)(f: PartialFunction[Any, Boolean]): Any
- Definition Classes
- TestKitBase
- def fishForSpecificMessage[T](max: Duration, hint: String)(f: PartialFunction[Any, T]): T
- Definition Classes
- TestKitBase
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getSchemaRegistryUrl: String
- Definition Classes
- Spec
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def ignoreMsg(f: PartialFunction[Any, Boolean]): Unit
- Definition Classes
- TestKitBase
- def ignoreNoMsg(): Unit
- Definition Classes
- TestKitBase
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def kafkaPort: Int
- Definition Classes
- TestcontainersKafkaLike → Spec → KafkaSpec
- def lastSender: ActorRef
- Definition Classes
- TestKitBase
- val log: Logger
- Definition Classes
- KafkaSpec → KafkaTestKit
- implicit val mat: Materializer
- Definition Classes
- KafkaSpec
- def msgAvailable: Boolean
- Definition Classes
- TestKitBase
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def now: FiniteDuration
- Definition Classes
- TestKitBase
- val partition0: Int
- Definition Classes
- KafkaSpec
- def periodicalCheck[T](description: String, maxTries: Int, sleepInBetween: FiniteDuration)(data: () => T)(predicate: (T) => Boolean): Unit
- Definition Classes
- KafkaSpec
- def produce(topic: String, range: Range, settings: ProducerSettings[String, String]): Future[Done]
Produce messages to topic using specified range and return a Future so the caller can synchronize consumption.
Produce messages to topic using specified range and return a Future so the caller can synchronize consumption.
- Definition Classes
- KafkaSpec
- def produce(topic: String, range: Seq[Int], partition: Int = partition0): Future[Done]
Produce messages to topic using specified range and return a Future so the caller can synchronize consumption.
Produce messages to topic using specified range and return a Future so the caller can synchronize consumption.
- Definition Classes
- KafkaSpec
- def produceBatches(topics: Seq[String], batches: Int, batchSize: Int): Future[Seq[Done]]
Produce batches over several topics.
Produce batches over several topics.
- Definition Classes
- KafkaSpec
- def produceString(topic: String, range: Seq[String], partition: Int = partition0): Future[Done]
- Definition Classes
- KafkaSpec
- def produceTimestamped(topic: String, timestampedRange: Seq[(Int, Long)]): Future[Done]
- Definition Classes
- KafkaSpec
- def producerDefaults[K, V](keySerializer: Serializer[K], valueSerializer: Serializer[V]): ProducerSettings[K, V]
- Definition Classes
- KafkaTestKit
- def producerDefaults: ProducerSettings[String, String]
- Definition Classes
- KafkaTestKit
- def receiveN(n: Int, max: FiniteDuration): Seq[AnyRef]
- Definition Classes
- TestKitBase
- def receiveN(n: Int): Seq[AnyRef]
- Definition Classes
- TestKitBase
- def receiveOne(max: Duration): AnyRef
- Definition Classes
- TestKitBase
- def receiveWhile[T](max: Duration, idle: Duration, messages: Int)(f: PartialFunction[AnyRef, T]): Seq[T]
- Definition Classes
- TestKitBase
- def remaining: FiniteDuration
- Definition Classes
- TestKitBase
- def remainingOr(duration: FiniteDuration): FiniteDuration
- Definition Classes
- TestKitBase
- def remainingOrDefault: FiniteDuration
- Definition Classes
- TestKitBase
- implicit val scheduler: Scheduler
- Definition Classes
- KafkaSpec
- def schemaRegistryContainer: Option[SchemaRegistryContainer]
- Definition Classes
- TestcontainersKafkaLike → Spec
- def schemaRegistryUrl: String
- Definition Classes
- TestcontainersKafkaLike → Spec
- def setAutoPilot(pilot: AutoPilot): Unit
- Definition Classes
- TestKitBase
- def setUp(): Unit
- Definition Classes
- TestcontainersKafkaLike → KafkaSpec
- def setUpAdminClient(): Unit
Create internal admin clients.
Create internal admin clients. Gives access to
adminClient
, be sure to callcleanUpAdminClient
after the tests are done.- Definition Classes
- KafkaTestKit
- val settings: KafkaTestkitSettings
- Definition Classes
- KafkaTestKit
- def shutdown(actorSystem: ActorSystem, duration: Duration, verifySystemShutdown: Boolean): Unit
- Definition Classes
- TestKitBase
- def sleep(time: FiniteDuration, msg: String = ""): Unit
- Definition Classes
- KafkaSpec
- def sleepAfterProduce: FiniteDuration
- Definition Classes
- KafkaSpec
- def sleepMillis(ms: Long, msg: String): Unit
- Definition Classes
- KafkaTestKit
- def sleepQuietly(time: FiniteDuration): Unit
- Definition Classes
- KafkaSpec
- def sleepSeconds(s: Int, msg: String): Unit
- Definition Classes
- KafkaTestKit
- def startCluster(settings: KafkaTestkitTestcontainersSettings): String
- Definition Classes
- TestcontainersKafkaLike → Spec
- def startCluster(): String
- Definition Classes
- TestcontainersKafkaLike → Spec
- def startKafka(): Unit
- Definition Classes
- TestcontainersKafkaLike → Spec
- def stopCluster(): Unit
- Definition Classes
- TestcontainersKafkaLike → Spec
- def stopKafka(): Unit
- Definition Classes
- TestcontainersKafkaLike → Spec
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- implicit val system: ActorSystem
- Definition Classes
- TestKit → TestKitBase
- lazy val testActor: ActorRef
- Definition Classes
- TestKitBase
- def testActorName: String
- Attributes
- protected
- Definition Classes
- TestKitBase
- def testKitSettings: TestKitSettings
- Definition Classes
- TestKitBase
- var testProducer: Producer[String, String]
- Definition Classes
- KafkaSpec
- val testcontainersSettings: KafkaTestkitTestcontainersSettings
Override this to change default settings for starting the Kafka testcontainers cluster.
Override this to change default settings for starting the Kafka testcontainers cluster.
- Definition Classes
- Spec
- def toString(): String
- Definition Classes
- AnyRef → Any
- def unwatch(ref: ActorRef): ActorRef
- Definition Classes
- TestKitBase
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def waitUntilCluster()(predicate: (DescribeClusterResult) => Boolean): Unit
Periodically checks if a given predicate on cluster state holds.
Periodically checks if a given predicate on cluster state holds.
If the predicate does not hold after configured amount of time, throws an exception.
- Definition Classes
- KafkaSpec
- def waitUntilConsumerGroup(groupId: String)(predicate: (ConsumerGroupDescription) => Boolean): Unit
Periodically checks if the given predicate on consumer group state holds.
Periodically checks if the given predicate on consumer group state holds.
If the predicate does not hold after configured amount of time, throws an exception.
- Definition Classes
- KafkaSpec
- def waitUntilConsumerSummary(groupId: String)(predicate: PartialFunction[List[MemberDescription], Boolean]): Unit
Periodically checks if the given predicate on consumer summary holds.
Periodically checks if the given predicate on consumer summary holds.
If the predicate does not hold after configured amount of time, throws an exception.
- Definition Classes
- KafkaSpec
- def watch(ref: ActorRef): ActorRef
- Definition Classes
- TestKitBase
- def within[T](max: FiniteDuration)(f: => T): T
- Definition Classes
- TestKitBase
- def within[T](min: FiniteDuration, max: FiniteDuration)(f: => T): T
- Definition Classes
- TestKitBase
- val zooKeeperPort: Int
- Definition Classes
- KafkaSpec
- def zookeeperContainer: GenericContainer[_]
- Definition Classes
- TestcontainersKafkaLike → Spec
Deprecated Value Members
- def createTransactionalId(suffix: Int): String
Return a unique transactional id with a given suffix.
Return a unique transactional id with a given suffix.
- Definition Classes
- KafkaTestKit
- Annotations
- @deprecated
- Deprecated
Use flows and sinks that does not require an explicit transaction id
- def createTransactionalId(): String
Return a unique transactional id with a default suffix.
Return a unique transactional id with a default suffix.
- Definition Classes
- KafkaTestKit
- Annotations
- @deprecated
- Deprecated
Use flows and sinks that does not require an explicit transaction id
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)