From c703388b164a0ffe489252f19b35fbaa145eac3f Mon Sep 17 00:00:00 2001 From: Ben Plommer Date: Mon, 28 Mar 2022 11:16:18 +0100 Subject: [PATCH 1/4] Update testcontainers version, set image name and version explicitly --- build.sbt | 2 +- modules/core/src/test/resources/logback-test.xml | 2 +- .../src/test/scala/fs2/kafka/BaseKafkaSpec.scala | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index dfdeebb74..a12c0d9d2 100644 --- a/build.sbt +++ b/build.sbt @@ -6,7 +6,7 @@ val fs2Version = "3.2.5" val kafkaVersion = "2.8.1" -val testcontainersScalaVersion = "0.40.0" +val testcontainersScalaVersion = "0.40.3" val vulcanVersion = "1.8.0" diff --git a/modules/core/src/test/resources/logback-test.xml b/modules/core/src/test/resources/logback-test.xml index 765daf771..840f42d31 100644 --- a/modules/core/src/test/resources/logback-test.xml +++ b/modules/core/src/test/resources/logback-test.xml @@ -6,7 +6,7 @@ - + diff --git a/modules/core/src/test/scala/fs2/kafka/BaseKafkaSpec.scala b/modules/core/src/test/scala/fs2/kafka/BaseKafkaSpec.scala index 0519b70a1..2690eb8ef 100644 --- a/modules/core/src/test/scala/fs2/kafka/BaseKafkaSpec.scala +++ b/modules/core/src/test/scala/fs2/kafka/BaseKafkaSpec.scala @@ -66,7 +66,15 @@ abstract class BaseKafkaSpec extends BaseAsyncSpec with ForEachTestContainer { override def runTest(testName: String, args: Args) = super.runTest(testName, args) - override val container: KafkaContainer = new KafkaContainer() + private val imageVersion = "7.0.1" + + private lazy val imageName = Option(System.getProperty("os.arch")) match { + case Some("aarch64") => + "niciqy/cp-kafka-arm64" // no official docker image for ARM is available yet + case _ => "confluentinc/cp-kafka" + } + + override val container: KafkaContainer = new KafkaContainer() {} .configure { container => container .withEnv("KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR", "1") @@ -75,8 +83,8 @@ abstract class BaseKafkaSpec extends BaseAsyncSpec with ForEachTestContainer { transactionTimeoutInterval.toMillis.toString ) .withEnv("KAFKA_TRANSACTION_STATE_LOG_MIN_ISR", "1") - .withEnv("KAFKA_AUTHORIZER_CLASS_NAME", "kafka.security.auth.SimpleAclAuthorizer") .withEnv("KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND", "true") + .setDockerImageName(s"$imageName:$imageVersion") () } From b29a524f271349a4d59b364b9c37c462e3d4c9b7 Mon Sep 17 00:00:00 2001 From: Ben Plommer Date: Mon, 28 Mar 2022 11:41:40 +0100 Subject: [PATCH 2/4] Up-to-date ACL authorizer --- modules/core/src/test/scala/fs2/kafka/BaseKafkaSpec.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/core/src/test/scala/fs2/kafka/BaseKafkaSpec.scala b/modules/core/src/test/scala/fs2/kafka/BaseKafkaSpec.scala index 2690eb8ef..1cd47ae8b 100644 --- a/modules/core/src/test/scala/fs2/kafka/BaseKafkaSpec.scala +++ b/modules/core/src/test/scala/fs2/kafka/BaseKafkaSpec.scala @@ -83,6 +83,7 @@ abstract class BaseKafkaSpec extends BaseAsyncSpec with ForEachTestContainer { transactionTimeoutInterval.toMillis.toString ) .withEnv("KAFKA_TRANSACTION_STATE_LOG_MIN_ISR", "1") + .withEnv("KAFKA_AUTHORIZER_CLASS_NAME", "kafka.security.authorizer.AclAuthorizer") .withEnv("KAFKA_ALLOW_EVERYONE_IF_NO_ACL_FOUND", "true") .setDockerImageName(s"$imageName:$imageVersion") From 5272208744c9a5791c434e8cab11b8dfa6f953b0 Mon Sep 17 00:00:00 2001 From: Ben Plommer Date: Mon, 28 Mar 2022 11:43:54 +0100 Subject: [PATCH 3/4] Use native Scala 3 testcontainers --- build.sbt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build.sbt b/build.sbt index a12c0d9d2..42634c290 100644 --- a/build.sbt +++ b/build.sbt @@ -99,10 +99,8 @@ lazy val docs = project lazy val dependencySettings = Seq( resolvers += "confluent" at "https://packages.confluent.io/maven/", libraryDependencies ++= Seq( - ("com.dimafeng" %% "testcontainers-scala-scalatest" % testcontainersScalaVersion) - .cross(CrossVersion.for3Use2_13), - ("com.dimafeng" %% "testcontainers-scala-kafka" % testcontainersScalaVersion) - .cross(CrossVersion.for3Use2_13), + "com.dimafeng" %% "testcontainers-scala-scalatest" % testcontainersScalaVersion, + "com.dimafeng" %% "testcontainers-scala-kafka" % testcontainersScalaVersion, "org.typelevel" %% "discipline-scalatest" % "2.1.5", "org.typelevel" %% "cats-effect-laws" % catsEffectVersion, "org.typelevel" %% "cats-effect-testkit" % catsEffectVersion, From 033e08395ecdb755f865ff1db12b6ab970ad0194 Mon Sep 17 00:00:00 2001 From: Ben Plommer Date: Mon, 28 Mar 2022 13:23:55 +0100 Subject: [PATCH 4/4] Remove unneeded braces --- modules/core/src/test/scala/fs2/kafka/BaseKafkaSpec.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/src/test/scala/fs2/kafka/BaseKafkaSpec.scala b/modules/core/src/test/scala/fs2/kafka/BaseKafkaSpec.scala index 1cd47ae8b..6de9508b3 100644 --- a/modules/core/src/test/scala/fs2/kafka/BaseKafkaSpec.scala +++ b/modules/core/src/test/scala/fs2/kafka/BaseKafkaSpec.scala @@ -74,7 +74,7 @@ abstract class BaseKafkaSpec extends BaseAsyncSpec with ForEachTestContainer { case _ => "confluentinc/cp-kafka" } - override val container: KafkaContainer = new KafkaContainer() {} + override val container: KafkaContainer = new KafkaContainer() .configure { container => container .withEnv("KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR", "1")