Skip to content

Commit

Permalink
Merge pull request #265 from frozenwizard/add-minio
Browse files Browse the repository at this point in the history
Bumps testcontainers-java to 1.19.1 and adds in MinIO
  • Loading branch information
dimafeng authored Dec 2, 2023
2 parents 8f79462 + c5e6c61 commit 69e5c65
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
9 changes: 9 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ lazy val root = (project in file("."))
moduleSolr,
moduleGcloud,
moduleRedpanda,
moduleMinIO,
allOld
)
.settings(noPublishSettings)
Expand Down Expand Up @@ -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
)
1 change: 1 addition & 0 deletions docs/src/main/tut/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
}
}
}
8 changes: 7 additions & 1 deletion project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -304,4 +304,10 @@ object Dependencies {
"org.apache.kafka" % "kafka-clients" % kafkaDriverVersion
)
)

val moduleMinIO = Def.setting(
COMPILE(
"org.testcontainers" % "minio" % testcontainersVersion
)
)
}

0 comments on commit 69e5c65

Please sign in to comment.