-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Anush <anushshetty90@gmail.com>
- Loading branch information
1 parent
0c9833b
commit 2c987ee
Showing
12 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ body: | |
- PostgreSQL | ||
- Presto | ||
- Pulsar | ||
- Qdrant | ||
- QuestDB | ||
- RabbitMQ | ||
- Redpanda | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ body: | |
- PostgreSQL | ||
- Presto | ||
- Pulsar | ||
- Qdrant | ||
- QuestDB | ||
- RabbitMQ | ||
- Redpanda | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,7 @@ body: | |
- Oracle XE | ||
- OrientDB | ||
- PostgreSQL | ||
- Qdrant | ||
- QuestDB | ||
- Presto | ||
- Pulsar | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Qdrant | ||
|
||
Testcontainers module for [Qdrant](https://registry.hub.docker.com/r/qdrant/qdrant) | ||
|
||
## Qdrant's usage examples | ||
|
||
You can start a Qdrant container instance from any Java application by using: | ||
|
||
<!--codeinclude--> | ||
[Default QDrant container](../../modules/qdrant/src/test/java/org/testcontainers/qdrant/QdrantContainerTest.java) inside_block:qdrantContainer | ||
<!--/codeinclude--> | ||
|
||
## Adding this module to your project dependencies | ||
|
||
Add the following dependency to your `pom.xml`/`build.gradle` file: | ||
|
||
=== "Gradle" | ||
```groovy | ||
testImplementation "org.testcontainers:qdrant:{{latest_version}}" | ||
``` | ||
|
||
=== "Maven" | ||
```xml | ||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>qdrant</artifactId> | ||
<version>{{latest_version}}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
description = "Testcontainers :: Qdrant" | ||
|
||
dependencies { | ||
api project(':testcontainers') | ||
|
||
testImplementation 'org.assertj:assertj-core:3.25.1' | ||
testImplementation 'io.qdrant:client:1.7.1' | ||
testImplementation platform('io.grpc:grpc-bom:1.61.1') | ||
testImplementation 'io.grpc:grpc-stub' | ||
testImplementation 'io.grpc:grpc-protobuf' | ||
testImplementation 'io.grpc:grpc-netty-shaded' | ||
} |
36 changes: 36 additions & 0 deletions
36
modules/qdrant/src/main/java/org/testcontainers/qdrant/QdrantContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.testcontainers.qdrant; | ||
|
||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.containers.wait.strategy.Wait; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
/** | ||
* Testcontainers implementation for Qdrant. | ||
* <p> | ||
* Supported image: {@code qdrant/qdrant} | ||
* <p> | ||
* Exposed ports: | ||
* <ul> | ||
* <li>HTTP: 6333</li> | ||
* <li>Grpc: 6334</li> | ||
* </ul> | ||
*/ | ||
public class QdrantContainer extends GenericContainer<QdrantContainer> { | ||
|
||
private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("qdrant/qdrant"); | ||
|
||
public QdrantContainer(String image) { | ||
this(DockerImageName.parse(image)); | ||
} | ||
|
||
public QdrantContainer(DockerImageName dockerImageName) { | ||
super(dockerImageName); | ||
dockerImageName.assertCompatibleWith(DEFAULT_IMAGE_NAME); | ||
withExposedPorts(6333, 6334); | ||
waitingFor(Wait.forHttp("/readyz").forPort(6333)); | ||
} | ||
|
||
public String getGrpcHostAddress() { | ||
return getHost() + ":" + getMappedPort(6334); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
modules/qdrant/src/test/java/org/testcontainers/qdrant/QdrantContainerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.testcontainers.qdrant; | ||
|
||
import io.grpc.Grpc; | ||
import io.grpc.InsecureChannelCredentials; | ||
import io.qdrant.client.QdrantGrpcClient; | ||
import io.qdrant.client.grpc.QdrantOuterClass; | ||
import org.junit.Test; | ||
|
||
import java.util.concurrent.ExecutionException; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class QdrantContainerTest { | ||
|
||
@Test | ||
public void test() throws ExecutionException, InterruptedException { | ||
try ( | ||
// qdrantContainer { | ||
QdrantContainer qdrant = new QdrantContainer("qdrant/qdrant:v1.7.4") | ||
// } | ||
) { | ||
qdrant.start(); | ||
|
||
QdrantGrpcClient client = QdrantGrpcClient | ||
.newBuilder( | ||
Grpc.newChannelBuilder(qdrant.getGrpcHostAddress(), InsecureChannelCredentials.create()).build() | ||
) | ||
.build(); | ||
QdrantOuterClass.HealthCheckReply healthCheckReply = client | ||
.qdrant() | ||
.healthCheck(QdrantOuterClass.HealthCheckRequest.getDefaultInstance()) | ||
.get(); | ||
assertThat(healthCheckReply.getVersion()).isEqualTo("1.7.4"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<configuration> | ||
|
||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<!-- encoders are assigned the type | ||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> | ||
<encoder> | ||
<pattern>%d{HH:mm:ss.SSS} %-5level %logger - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="INFO"> | ||
<appender-ref ref="STDOUT"/> | ||
</root> | ||
|
||
<logger name="org.testcontainers" level="INFO"/> | ||
</configuration> |