File tree 12 files changed +131
-0
lines changed
main/java/org/testcontainers/weaviate
java/org/testcontainers/weaviate
12 files changed +131
-0
lines changed Original file line number Diff line number Diff line change 55
55
- ToxiProxy
56
56
- Trino
57
57
- Vault
58
+ - Weaviate
58
59
- YugabyteDB
59
60
validations :
60
61
required : true
Original file line number Diff line number Diff line change 55
55
- ToxiProxy
56
56
- Trino
57
57
- Vault
58
+ - Weaviate
58
59
- YugabyteDB
59
60
validations :
60
61
required : true
Original file line number Diff line number Diff line change 55
55
- ToxiProxy
56
56
- Trino
57
57
- Vault
58
+ - Weaviate
58
59
- YugabyteDB
59
60
- New Module
60
61
- type : textarea
Original file line number Diff line number Diff line change @@ -302,6 +302,11 @@ updates:
302
302
schedule :
303
303
interval : " weekly"
304
304
open-pull-requests-limit : 10
305
+ - package-ecosystem : " gradle"
306
+ directory : " /modules/weaviate"
307
+ schedule :
308
+ interval : " weekly"
309
+ open-pull-requests-limit : 10
305
310
- package-ecosystem : " gradle"
306
311
directory : " /modules/yugabytedb"
307
312
schedule :
Original file line number Diff line number Diff line change 192
192
- changed-files :
193
193
- any-glob-to-any-file :
194
194
- modules/vault/**/*
195
+ " modules/weaviate " :
196
+ - changed-files :
197
+ - any-glob-to-any-file :
198
+ - modules/weaviate/**/*
195
199
" modules/yugabytedb " :
196
200
- changed-files :
197
201
- any-glob-to-any-file :
Original file line number Diff line number Diff line change @@ -238,6 +238,9 @@ labels:
238
238
- name : modules/vault
239
239
color : ' #006b75'
240
240
241
+ - name : modules/weaviate
242
+ color : ' #006b75'
243
+
241
244
- name : modules/yugabytedb
242
245
color : ' #006b75'
243
246
Original file line number Diff line number Diff line change
1
+ # Weaviate
2
+
3
+ Testcontainers module for [ Weaviate] ( https://hub.docker.com/r/semitechnologies/weaviate )
4
+
5
+ ## WeaviateContainer's usage examples
6
+
7
+ You can start a Weaviate container instance from any Java application by using:
8
+
9
+ <!-- codeinclude-->
10
+ [ Default Weaviate container] ( ../../modules/weaviate/src/test/java/org/testcontainers/weaviate/WeaviateContainerTest.java ) inside_block: container
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:weaviate:{{latest_version}}"
20
+ ```
21
+
22
+ === "Maven"
23
+ ``` xml
24
+ <dependency >
25
+ <groupId >org.testcontainers</groupId >
26
+ <artifactId >weaviate</artifactId >
27
+ <version >{{latest_version}}</version >
28
+ <scope >test</scope >
29
+ </dependency >
30
+ ```
Original file line number Diff line number Diff line change 93
93
- modules/solr.md
94
94
- modules/toxiproxy.md
95
95
- modules/vault.md
96
+ - modules/weaviate.md
96
97
- modules/webdriver_containers.md
97
98
- Test framework integration :
98
99
- test_framework_integration/junit_4.md
Original file line number Diff line number Diff line change
1
+ description = " Testcontainers :: Weaviate"
2
+
3
+ dependencies {
4
+ api project(' :testcontainers' )
5
+
6
+ testImplementation ' org.assertj:assertj-core:3.25.1'
7
+ testImplementation ' io.weaviate:client:4.5.1'
8
+ }
Original file line number Diff line number Diff line change
1
+ package org .testcontainers .weaviate ;
2
+
3
+ import org .testcontainers .containers .GenericContainer ;
4
+ import org .testcontainers .utility .DockerImageName ;
5
+
6
+ /**
7
+ * Testcontainers implementation of Weaviate.
8
+ * <p>
9
+ * Supported image: {@code semitechnologies/weaviate}
10
+ * <p>
11
+ * Exposed ports:
12
+ * <ul>
13
+ * <li>HTTP: 8080</li>
14
+ * <li>gRPC: 50051</li>
15
+ * </ul>
16
+ */
17
+ public class WeaviateContainer extends GenericContainer <WeaviateContainer > {
18
+
19
+ private static final String WEAVIATE_IMAGE = "semitechnologies/weaviate" ;
20
+
21
+ public WeaviateContainer (String dockerImageName ) {
22
+ this (DockerImageName .parse (dockerImageName ));
23
+ }
24
+
25
+ public WeaviateContainer (DockerImageName dockerImageName ) {
26
+ super (dockerImageName );
27
+ dockerImageName .assertCompatibleWith (DockerImageName .parse (WEAVIATE_IMAGE ));
28
+ withExposedPorts (8080 , 50051 );
29
+ withEnv ("AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED" , "true" );
30
+ withEnv ("PERSISTENCE_DATA_PATH" , "/var/lib/weaviate" );
31
+ }
32
+
33
+ public String getHttpHostAddress () {
34
+ return getHost () + ":" + getMappedPort (8080 );
35
+ }
36
+ }
Original file line number Diff line number Diff line change
1
+ package org .testcontainers .weaviate ;
2
+
3
+ import io .weaviate .client .Config ;
4
+ import io .weaviate .client .WeaviateClient ;
5
+ import io .weaviate .client .base .Result ;
6
+ import io .weaviate .client .v1 .misc .model .Meta ;
7
+ import org .junit .Test ;
8
+
9
+ import static org .assertj .core .api .Assertions .assertThat ;
10
+
11
+ public class WeaviateContainerTest {
12
+
13
+ @ Test
14
+ public void test () {
15
+ try ( // container {
16
+ WeaviateContainer weaviate = new WeaviateContainer ("semitechnologies/weaviate:1.22.4" )
17
+ // }
18
+ ) {
19
+ weaviate .start ();
20
+ WeaviateClient client = new WeaviateClient (new Config ("http" , weaviate .getHttpHostAddress ()));
21
+ Result <Meta > meta = client .misc ().metaGetter ().run ();
22
+ assertThat (meta .getResult ().getVersion ()).isEqualTo ("1.22.4" );
23
+ }
24
+ }
25
+ }
Original file line number Diff line number Diff line change
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 >
You can’t perform that action at this time.
0 commit comments