File tree Expand file tree Collapse file tree 4 files changed +92
-0
lines changed
main/scala/com/dimafeng/testcontainers
test/scala/com/dimafeng/testcontainers Expand file tree Collapse file tree 4 files changed +92
-0
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ lazy val root = (project in file("."))
8888 moduleMockserver,
8989 moduleNginx,
9090 modulePulsar,
91+ moduleQuadrant,
9192 moduleRabbitmq,
9293 moduleRedis,
9394 moduleToxiproxy,
@@ -431,6 +432,14 @@ lazy val modulePulsar = (project in file("modules/pulsar"))
431432 libraryDependencies ++= Dependencies .modulePulsar.value
432433 )
433434
435+ lazy val moduleQuadrant = (project in file(" modules/quadrant" ))
436+ .dependsOn(core % " compile->compile;test->test;provided->provided" , scalatest % " test->test" )
437+ .settings(commonSettings)
438+ .settings(
439+ name := " testcontainers-scala-quadrant" ,
440+ libraryDependencies ++= Dependencies .moduleQuadrant.value
441+ )
442+
434443lazy val moduleRabbitmq = (project in file(" modules/rabbitmq" ))
435444 .dependsOn(core % " compile->compile;test->test;provided->provided" , scalatest % " test->test" )
436445 .settings(commonSettings)
Original file line number Diff line number Diff line change 1+ package com .dimafeng .testcontainers
2+
3+ import org .testcontainers .images .builder .Transferable
4+ import org .testcontainers .qdrant .{QdrantContainer => JavaQdrantContainer }
5+ import org .testcontainers .utility .DockerImageName
6+
7+ class QdrantContainer (
8+ underlying : JavaQdrantContainer
9+ ) extends SingleContainer [JavaQdrantContainer ] { self =>
10+
11+ override val container : JavaQdrantContainer = underlying
12+
13+ def grpcPort : Int = container.getGrpcPort
14+
15+ def grpcHostAddress : String = container.getGrpcHostAddress
16+
17+ }
18+
19+ object QdrantContainer {
20+
21+ val defaultImage = " qdrant/qdrant"
22+ val defaultTag = " v1.12.1"
23+ val defaultDockerImageName = s " $defaultImage: $defaultTag"
24+
25+ case class Def (
26+ dockerImageName : DockerImageName = DockerImageName .parse(QdrantContainer .defaultDockerImageName),
27+ builder : List [JavaQdrantContainer => JavaQdrantContainer ] = List .empty
28+ ) extends ContainerDef {
29+ override type Container = QdrantContainer
30+
31+ def withApiKey (apiKey : String ): Def =
32+ copy(builder = ((_ : JavaQdrantContainer ).withApiKey(apiKey)) :: builder)
33+
34+ def withConfigFile (configFile : Transferable ): Def =
35+ copy(builder = ((_ : JavaQdrantContainer ).withConfigFile(configFile)) :: builder)
36+
37+ override def createContainer (): QdrantContainer =
38+ new QdrantContainer (
39+ builder
40+ .foldRight(new JavaQdrantContainer (dockerImageName))((f, underlying) => f(underlying))
41+ )
42+ }
43+ }
Original file line number Diff line number Diff line change 1+ package com .dimafeng .testcontainers
2+
3+ import com .dimafeng .testcontainers .scalatest .TestContainersForAll
4+ import io .qdrant .client .{QdrantClient , QdrantGrpcClient }
5+ import org .scalatest .flatspec .AnyFlatSpec
6+
7+ import java .util .UUID
8+
9+ class QdrantSpec extends AnyFlatSpec with TestContainersForAll {
10+ override type Containers = QdrantContainer
11+
12+ override def startContainers (): QdrantContainer =
13+ QdrantContainer .Def ().withApiKey(QdrantSpec .apiKey).start()
14+
15+ " Qdrant container" should " be started" in withContainers { qdrantContainer =>
16+ val client = new QdrantClient (
17+ QdrantGrpcClient
18+ .newBuilder(qdrantContainer.host, qdrantContainer.grpcPort, false )
19+ .withApiKey(QdrantSpec .apiKey)
20+ .build()
21+ )
22+ val healthCheckReply = client.healthCheckAsync().get()
23+
24+ assert(healthCheckReply.getVersion.nonEmpty)
25+ }
26+
27+ }
28+
29+ object QdrantSpec {
30+ val apiKey : String = UUID .randomUUID().toString
31+ }
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ object Dependencies {
4040 private val jedisVersion = " 5.0.0"
4141 private val wireMockTestcontainersVersion = " 1.0-alpha-13"
4242 private val milvusSdkVersion = " 2.4.1"
43+ private val quadrantClientVersion = " 1.12.0"
4344 private val yugabyteJdbcVersion = " 42.3.5-yb-6"
4445 private val yugabyteJavaDriverVersion = " 4.15.0-yb-2-TESTFIX.0"
4546
@@ -257,6 +258,14 @@ object Dependencies {
257258 )
258259 )
259260
261+ val moduleQuadrant = Def .setting(
262+ COMPILE (
263+ " org.testcontainers" % " qdrant" % testcontainersVersion
264+ ) ++ TEST (
265+ " io.qdrant" % " client" % quadrantClientVersion
266+ )
267+ )
268+
260269 val moduleRabbitmq = Def .setting(
261270 COMPILE (
262271 " org.testcontainers" % " rabbitmq" % testcontainersVersion
You can’t perform that action at this time.
0 commit comments