codacy.test.docker.MinioDocker.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of codacy-test-bench_2.13 Show documentation
Show all versions of codacy-test-bench_2.13 Show documentation
A library to send events on rabbit-mq
The newest version!
package codacy.test.docker
import com.whisk.docker.{DockerContainer, DockerReadyChecker}
import scala.concurrent.duration._
/** Scaffolding for starting a [[https://hub.docker.com/r/minio/minio Minio docker image]].
* This class is meant to be used for testing purposes only.
*/
trait MinioDocker {
// This image is locked to this specific version because it's the one used in legacy enterprise.
val minioImage = "minio/minio:RELEASE.2018-06-09T03-43-35Z"
val minioPort = 9000
val minioPortMapping = Seq(9000 -> Some(minioPort))
val minioAccessKey = "random_access_key"
val minioSecretKey = "random_secret_key"
val minioRegion = "eu-west-1"
val minioDirectory = "/tmp"
lazy val minioContainer = DockerContainer(minioImage)
.withPorts(minioPortMapping: _*)
.withEnv(s"MINIO_ACCESS_KEY=$minioAccessKey", s"MINIO_SECRET_KEY=$minioSecretKey", s"MINIO_REGION=$minioRegion")
.withCommand("server", minioDirectory)
.withReadyChecker(
// If the container is up, it responds with 403 to simple (unauthenticated) GET requests
DockerReadyChecker.HttpResponseCode(minioPort, code = 403).within(200.millis).looped(20, 200.millis)
)
}