Skip to content

Commit 2c987ee

Browse files
Add Qdrant module (#8353)
Co-authored-by: Anush <anushshetty90@gmail.com>
1 parent 0c9833b commit 2c987ee

File tree

12 files changed

+146
-0
lines changed

12 files changed

+146
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ body:
4747
- PostgreSQL
4848
- Presto
4949
- Pulsar
50+
- Qdrant
5051
- QuestDB
5152
- RabbitMQ
5253
- Redpanda

.github/ISSUE_TEMPLATE/enhancement.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ body:
4747
- PostgreSQL
4848
- Presto
4949
- Pulsar
50+
- Qdrant
5051
- QuestDB
5152
- RabbitMQ
5253
- Redpanda

.github/ISSUE_TEMPLATE/feature.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ body:
4545
- Oracle XE
4646
- OrientDB
4747
- PostgreSQL
48+
- Qdrant
4849
- QuestDB
4950
- Presto
5051
- Pulsar

.github/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,11 @@ updates:
240240
schedule:
241241
interval: "weekly"
242242
open-pull-requests-limit: 10
243+
- package-ecosystem: "gradle"
244+
directory: "/modules/qdrant"
245+
schedule:
246+
interval: "weekly"
247+
open-pull-requests-limit: 10
243248
- package-ecosystem: "gradle"
244249
directory: "/modules/questdb"
245250
schedule:

.github/labeler.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@
152152
- changed-files:
153153
- any-glob-to-any-file:
154154
- modules/pulsar/**/*
155+
"modules/qdrant":
156+
- changed-files:
157+
- any-glob-to-any-file:
158+
- modules/qdrant/**/*
155159
"modules/questdb":
156160
- changed-files:
157161
- any-glob-to-any-file:

.github/settings.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ labels:
205205
- name: modules/pulsar
206206
color: '#006b75'
207207

208+
- name: modules/qdrant
209+
color: '#006b75'
210+
208211
- name: modules/questdb
209212
color: '#006b75'
210213

docs/modules/qdrant.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Qdrant
2+
3+
Testcontainers module for [Qdrant](https://registry.hub.docker.com/r/qdrant/qdrant)
4+
5+
## Qdrant's usage examples
6+
7+
You can start a Qdrant container instance from any Java application by using:
8+
9+
<!--codeinclude-->
10+
[Default QDrant container](../../modules/qdrant/src/test/java/org/testcontainers/qdrant/QdrantContainerTest.java) inside_block:qdrantContainer
11+
<!--/codeinclude-->
12+
13+
## Adding this module to your project dependencies
14+
15+
Add the following dependency to your `pom.xml`/`build.gradle` file:
16+
17+
=== "Gradle"
18+
```groovy
19+
testImplementation "org.testcontainers:qdrant:{{latest_version}}"
20+
```
21+
22+
=== "Maven"
23+
```xml
24+
<dependency>
25+
<groupId>org.testcontainers</groupId>
26+
<artifactId>qdrant</artifactId>
27+
<version>{{latest_version}}</version>
28+
<scope>test</scope>
29+
</dependency>
30+
```

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ nav:
8989
- modules/mockserver.md
9090
- modules/nginx.md
9191
- modules/pulsar.md
92+
- modules/qdrant.md
9293
- modules/rabbitmq.md
9394
- modules/redpanda.md
9495
- modules/solace.md

modules/qdrant/build.gradle

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
description = "Testcontainers :: Qdrant"
2+
3+
dependencies {
4+
api project(':testcontainers')
5+
6+
testImplementation 'org.assertj:assertj-core:3.25.1'
7+
testImplementation 'io.qdrant:client:1.7.1'
8+
testImplementation platform('io.grpc:grpc-bom:1.61.1')
9+
testImplementation 'io.grpc:grpc-stub'
10+
testImplementation 'io.grpc:grpc-protobuf'
11+
testImplementation 'io.grpc:grpc-netty-shaded'
12+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.testcontainers.qdrant;
2+
3+
import org.testcontainers.containers.GenericContainer;
4+
import org.testcontainers.containers.wait.strategy.Wait;
5+
import org.testcontainers.utility.DockerImageName;
6+
7+
/**
8+
* Testcontainers implementation for Qdrant.
9+
* <p>
10+
* Supported image: {@code qdrant/qdrant}
11+
* <p>
12+
* Exposed ports:
13+
* <ul>
14+
* <li>HTTP: 6333</li>
15+
* <li>Grpc: 6334</li>
16+
* </ul>
17+
*/
18+
public class QdrantContainer extends GenericContainer<QdrantContainer> {
19+
20+
private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("qdrant/qdrant");
21+
22+
public QdrantContainer(String image) {
23+
this(DockerImageName.parse(image));
24+
}
25+
26+
public QdrantContainer(DockerImageName dockerImageName) {
27+
super(dockerImageName);
28+
dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME);
29+
withExposedPorts(6333, 6334);
30+
waitingFor(Wait.forHttp("/readyz").forPort(6333));
31+
}
32+
33+
public String getGrpcHostAddress() {
34+
return getHost() + ":" + getMappedPort(6334);
35+
}
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.testcontainers.qdrant;
2+
3+
import io.grpc.Grpc;
4+
import io.grpc.InsecureChannelCredentials;
5+
import io.qdrant.client.QdrantGrpcClient;
6+
import io.qdrant.client.grpc.QdrantOuterClass;
7+
import org.junit.Test;
8+
9+
import java.util.concurrent.ExecutionException;
10+
11+
import static org.assertj.core.api.Assertions.assertThat;
12+
13+
public class QdrantContainerTest {
14+
15+
@Test
16+
public void test() throws ExecutionException, InterruptedException {
17+
try (
18+
// qdrantContainer {
19+
QdrantContainer qdrant = new QdrantContainer("qdrant/qdrant:v1.7.4")
20+
// }
21+
) {
22+
qdrant.start();
23+
24+
QdrantGrpcClient client = QdrantGrpcClient
25+
.newBuilder(
26+
Grpc.newChannelBuilder(qdrant.getGrpcHostAddress(), InsecureChannelCredentials.create()).build()
27+
)
28+
.build();
29+
QdrantOuterClass.HealthCheckReply healthCheckReply = client
30+
.qdrant()
31+
.healthCheck(QdrantOuterClass.HealthCheckRequest.getDefaultInstance())
32+
.get();
33+
assertThat(healthCheckReply.getVersion()).isEqualTo("1.7.4");
34+
}
35+
}
36+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<configuration>
2+
3+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
4+
<!-- encoders are assigned the type
5+
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
6+
<encoder>
7+
<pattern>%d{HH:mm:ss.SSS} %-5level %logger - %msg%n</pattern>
8+
</encoder>
9+
</appender>
10+
11+
<root level="INFO">
12+
<appender-ref ref="STDOUT"/>
13+
</root>
14+
15+
<logger name="org.testcontainers" level="INFO"/>
16+
</configuration>

0 commit comments

Comments
 (0)