-
-
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.
- Loading branch information
1 parent
329e972
commit f45bb44
Showing
12 changed files
with
131 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 |
---|---|---|
|
@@ -55,6 +55,7 @@ body: | |
- ToxiProxy | ||
- Trino | ||
- Vault | ||
- Weaviate | ||
- YugabyteDB | ||
validations: | ||
required: true | ||
|
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 |
---|---|---|
|
@@ -55,6 +55,7 @@ body: | |
- ToxiProxy | ||
- Trino | ||
- Vault | ||
- Weaviate | ||
- YugabyteDB | ||
validations: | ||
required: true | ||
|
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 |
---|---|---|
|
@@ -55,6 +55,7 @@ body: | |
- ToxiProxy | ||
- Trino | ||
- Vault | ||
- Weaviate | ||
- YugabyteDB | ||
- New Module | ||
- type: textarea | ||
|
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 @@ | ||
# Weaviate | ||
|
||
Testcontainers module for [Weaviate](https://hub.docker.com/r/semitechnologies/weaviate) | ||
|
||
## WeaviateContainer's usage examples | ||
|
||
You can start a Weaviate container instance from any Java application by using: | ||
|
||
<!--codeinclude--> | ||
[Default Weaviate container](../../modules/weaviate/src/test/java/org/testcontainers/weaviate/WeaviateContainerTest.java) inside_block:container | ||
<!--/codeinclude--> | ||
|
||
## Adding this module to your project dependencies | ||
|
||
Add the following dependency to your `pom.xml`/`build.gradle` file: | ||
|
||
=== "Gradle" | ||
```groovy | ||
testImplementation "org.testcontainers:weaviate:{{latest_version}}" | ||
``` | ||
|
||
=== "Maven" | ||
```xml | ||
<dependency> | ||
<groupId>org.testcontainers</groupId> | ||
<artifactId>weaviate</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,8 @@ | ||
description = "Testcontainers :: Weaviate" | ||
|
||
dependencies { | ||
api project(':testcontainers') | ||
|
||
testImplementation 'org.assertj:assertj-core:3.25.1' | ||
testImplementation 'io.weaviate:client:4.5.1' | ||
} |
36 changes: 36 additions & 0 deletions
36
modules/weaviate/src/main/java/org/testcontainers/weaviate/WeaviateContainer.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.weaviate; | ||
|
||
import org.testcontainers.containers.GenericContainer; | ||
import org.testcontainers.utility.DockerImageName; | ||
|
||
/** | ||
* Testcontainers implementation of Weaviate. | ||
* <p> | ||
* Supported image: {@code semitechnologies/weaviate} | ||
* <p> | ||
* Exposed ports: | ||
* <ul> | ||
* <li>HTTP: 8080</li> | ||
* <li>gRPC: 50051</li> | ||
* </ul> | ||
*/ | ||
public class WeaviateContainer extends GenericContainer<WeaviateContainer> { | ||
|
||
private static final String WEAVIATE_IMAGE = "semitechnologies/weaviate"; | ||
|
||
public WeaviateContainer(String dockerImageName) { | ||
this(DockerImageName.parse(dockerImageName)); | ||
} | ||
|
||
public WeaviateContainer(DockerImageName dockerImageName) { | ||
super(dockerImageName); | ||
dockerImageName.assertCompatibleWith(DockerImageName.parse(WEAVIATE_IMAGE)); | ||
withExposedPorts(8080, 50051); | ||
withEnv("AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED", "true"); | ||
withEnv("PERSISTENCE_DATA_PATH", "/var/lib/weaviate"); | ||
} | ||
|
||
public String getHttpHostAddress() { | ||
return getHost() + ":" + getMappedPort(8080); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
modules/weaviate/src/test/java/org/testcontainers/weaviate/WeaviateContainerTest.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,25 @@ | ||
package org.testcontainers.weaviate; | ||
|
||
import io.weaviate.client.Config; | ||
import io.weaviate.client.WeaviateClient; | ||
import io.weaviate.client.base.Result; | ||
import io.weaviate.client.v1.misc.model.Meta; | ||
import org.junit.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class WeaviateContainerTest { | ||
|
||
@Test | ||
public void test() { | ||
try ( // container { | ||
WeaviateContainer weaviate = new WeaviateContainer("semitechnologies/weaviate:1.22.4") | ||
// } | ||
) { | ||
weaviate.start(); | ||
WeaviateClient client = new WeaviateClient(new Config("http", weaviate.getHttpHostAddress())); | ||
Result<Meta> meta = client.misc().metaGetter().run(); | ||
assertThat(meta.getResult().getVersion()).isEqualTo("1.22.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> |