diff --git a/build.sbt b/build.sbt index 7a930493..45008a08 100644 --- a/build.sbt +++ b/build.sbt @@ -96,6 +96,7 @@ lazy val root = (project in file(".")) moduleSolr, moduleGcloud, moduleRedpanda, + moduleMinIO, allOld ) .settings(noPublishSettings) @@ -489,3 +490,11 @@ lazy val moduleRedpanda = (project in file("modules/redpanda")) name := "testcontainers-scala-redpanda", libraryDependencies ++= Dependencies.moduleRedpanda.value ) + +lazy val moduleMinIO = (project in file("modules/minio")) + .dependsOn(core % "compile->compile;test->test;provided->provided", scalatest % "test->test") + .settings(commonSettings) + .settings( + name := "testcontainers-scala-minio", + libraryDependencies ++= Dependencies.moduleMinIO.value + ) diff --git a/docs/src/main/tut/setup.md b/docs/src/main/tut/setup.md index 587adcef..0146c66e 100644 --- a/docs/src/main/tut/setup.md +++ b/docs/src/main/tut/setup.md @@ -91,6 +91,7 @@ Here is the full list of the [currently available modules](https://github.com/te * `testcontainers-scala-mongodb` — module with the MongoDB container. * `testcontainers-scala-solr` — module with the Solr container. * `testcontainers-scala-gcloud` — module with the Bigtable, Firebase and PubSub emulator containers. +* `testcontainers-scala-minio` — module with MinIO container. Most of the modules are just proxies to the testcontainers-java modules and behave exactly like java containers. You can find documentation about them in the [testcontainers-java docs pages](https://www.testcontainers.org/). diff --git a/modules/minio/src/main/scala/com/dimafeng/testcontainers/MinIOContainer.scala b/modules/minio/src/main/scala/com/dimafeng/testcontainers/MinIOContainer.scala new file mode 100644 index 00000000..4e6b14c0 --- /dev/null +++ b/modules/minio/src/main/scala/com/dimafeng/testcontainers/MinIOContainer.scala @@ -0,0 +1,39 @@ +package com.dimafeng.testcontainers + +import org.testcontainers.containers.{MinIOContainer => JavaMinIOContainer} +import org.testcontainers.utility.DockerImageName + +case class MinIOContainer( + dockerImageName: DockerImageName = DockerImageName.parse(MinIOContainer.defaultDockerImageName), + userName: String = MinIOContainer.defaultUserName, + password: String = MinIOContainer.defaultPassword + ) extends SingleContainer[JavaMinIOContainer] { + + override val container: JavaMinIOContainer = { + val c = new JavaMinIOContainer(dockerImageName) + c.withUserName(userName) + c.withPassword(password) + c + } + + def s3URL: String = container.getS3URL() +} + +object MinIOContainer { + + val defaultImage = "minio/minio" + val defaultTag = "RELEASE.2023-09-04T19-57-37Z" + val defaultDockerImageName = s"$defaultImage:$defaultTag" + + val defaultUserName = "miniouser" + val defaultPassword = "miniopassword" + + case class Def(dockerImageName: DockerImageName = DockerImageName.parse(MinIOContainer.defaultDockerImageName), + userName: String = MinIOContainer.defaultUserName, password: String = MinIOContainer.defaultPassword) extends ContainerDef { + override type Container = MinIOContainer + + override def createContainer(): MinIOContainer = { + new MinIOContainer(dockerImageName, userName, password) + } + } +} \ No newline at end of file diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 10d5951b..f26a02d7 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -12,7 +12,7 @@ object Dependencies { scope.map(s => modules.map(_ % s)).getOrElse(modules) } - private val testcontainersVersion = "1.19.0" + private val testcontainersVersion = "1.19.1" private val seleniumVersion = "2.53.1" private val slf4jVersion = "1.7.32" private val scalaTestVersion = "3.2.9" @@ -304,4 +304,10 @@ object Dependencies { "org.apache.kafka" % "kafka-clients" % kafkaDriverVersion ) ) + + val moduleMinIO = Def.setting( + COMPILE( + "org.testcontainers" % "minio" % testcontainersVersion + ) + ) }