Skip to content

Commit

Permalink
[weaviate] Add wait strategy (testcontainers#8800)
Browse files Browse the repository at this point in the history
* Update image version to v1.25

---------

Co-authored-by: Eddú Meléndez Gonzales <eddu.melendez@gmail.com>
  • Loading branch information
2 people authored and lizhou1111 committed Jul 13, 2024
1 parent f09d0d2 commit cfc4670
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.testcontainers.weaviate;

import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.utility.DockerImageName;

/**
Expand Down Expand Up @@ -32,6 +33,7 @@ public WeaviateContainer(DockerImageName dockerImageName) {
withExposedPorts(8080, 50051);
withEnv("AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED", "true");
withEnv("PERSISTENCE_DATA_PATH", "/var/lib/weaviate");
waitingFor(Wait.forHttp("/v1/.well-known/ready").forPort(8080).forStatusCode(200));
}

public String getHttpHostAddress() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ public class WeaviateContainerTest {
@Test
public void testWeaviate() {
try ( // container {
WeaviateContainer weaviate = new WeaviateContainer("cr.weaviate.io/semitechnologies/weaviate:1.24.5")
WeaviateContainer weaviate = new WeaviateContainer("cr.weaviate.io/semitechnologies/weaviate:1.25.5")
// }
) {
weaviate.start();
Config config = new Config("http", weaviate.getHttpHostAddress());
config.setGRPCHost(weaviate.getGrpcHostAddress());
WeaviateClient client = new WeaviateClient(config);
Result<Meta> meta = client.misc().metaGetter().run();
assertThat(meta.getResult().getVersion()).isEqualTo("1.24.5");
assertThat(meta.getResult().getVersion()).isEqualTo("1.25.5");
}
}

Expand All @@ -43,13 +43,13 @@ public void testWeaviateWithModules() {
Map<String, String> env = new HashMap<>();
env.put("ENABLE_MODULES", String.join(",", enableModules));
env.put("BACKUP_FILESYSTEM_PATH", "/tmp/backups");
try (WeaviateContainer weaviate = new WeaviateContainer("semitechnologies/weaviate:1.24.5").withEnv(env)) {
try (WeaviateContainer weaviate = new WeaviateContainer("semitechnologies/weaviate:1.25.5").withEnv(env)) {
weaviate.start();
Config config = new Config("http", weaviate.getHttpHostAddress());
config.setGRPCHost(weaviate.getGrpcHostAddress());
WeaviateClient client = new WeaviateClient(config);
Result<Meta> meta = client.misc().metaGetter().run();
assertThat(meta.getResult().getVersion()).isEqualTo("1.24.5");
assertThat(meta.getResult().getVersion()).isEqualTo("1.25.5");
Object modules = meta.getResult().getModules();
assertThat(modules)
.isNotNull()
Expand Down

0 comments on commit cfc4670

Please sign in to comment.