-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
71 additions
and
72 deletions.
There are no files selected for viewing
18 changes: 0 additions & 18 deletions
18
benchmarks/src/it/scala/akka/kafka/benchmarks/TestTester.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package akka.kafka | ||
|
||
import akka.NotUsed | ||
import akka.stream.scaladsl.Flow | ||
import org.apache.kafka.common.TopicPartition | ||
import org.slf4j.Logger | ||
import org.testcontainers.containers.GenericContainer | ||
|
||
import scala.collection.JavaConverters._ | ||
|
||
object IntegrationTests { | ||
val MessageLogInterval = 500L | ||
|
||
def logSentMessages() | ||
(implicit log: Logger): Flow[Long, Long, NotUsed] = Flow[Long].map { i => | ||
if (i % MessageLogInterval == 0) log.info(s"Sent [$i] messages so far.") | ||
i | ||
} | ||
|
||
def logReceivedMessages() | ||
(implicit log: Logger): Flow[Long, Long, NotUsed] = Flow[Long].map { i => | ||
if (i % MessageLogInterval == 0) log.info(s"Received [$i] messages so far.") | ||
i | ||
} | ||
|
||
def logReceivedMessages(tp: TopicPartition) | ||
(implicit log: Logger): Flow[Long, Long, NotUsed] = Flow[Long].map { i => | ||
if (i % MessageLogInterval == 0) log.info(s"$tp: Received [$i] messages so far.") | ||
i | ||
} | ||
|
||
def stopRandomBroker(brokers: Vector[GenericContainer[_]], msgCount: Long) | ||
(implicit log: Logger): Unit = { | ||
val broker: GenericContainer[_] = brokers(scala.util.Random.nextInt(brokers.length)) | ||
val id = broker.getContainerId | ||
val networkAliases = broker.getNetworkAliases.asScala.mkString(",") | ||
log.warn(s"Stopping one Kafka container with network aliases [$networkAliases], container id [$id], after [$msgCount] messages") | ||
broker.stop() | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters