From cfc46705477f1511af6c4d2c25d7bc37ab1c0671 Mon Sep 17 00:00:00 2001 From: Marcin Antas Date: Tue, 25 Jun 2024 07:51:02 +0200 Subject: [PATCH] [weaviate] Add wait strategy (#8800) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update image version to v1.25 --------- Co-authored-by: EddĂș MelĂ©ndez Gonzales --- .../org/testcontainers/weaviate/WeaviateContainer.java | 2 ++ .../testcontainers/weaviate/WeaviateContainerTest.java | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/weaviate/src/main/java/org/testcontainers/weaviate/WeaviateContainer.java b/modules/weaviate/src/main/java/org/testcontainers/weaviate/WeaviateContainer.java index 6225c79dd4a..86aff57ae5d 100644 --- a/modules/weaviate/src/main/java/org/testcontainers/weaviate/WeaviateContainer.java +++ b/modules/weaviate/src/main/java/org/testcontainers/weaviate/WeaviateContainer.java @@ -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; /** @@ -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() { diff --git a/modules/weaviate/src/test/java/org/testcontainers/weaviate/WeaviateContainerTest.java b/modules/weaviate/src/test/java/org/testcontainers/weaviate/WeaviateContainerTest.java index c74c6454d0d..53096182839 100644 --- a/modules/weaviate/src/test/java/org/testcontainers/weaviate/WeaviateContainerTest.java +++ b/modules/weaviate/src/test/java/org/testcontainers/weaviate/WeaviateContainerTest.java @@ -19,7 +19,7 @@ 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(); @@ -27,7 +27,7 @@ public void testWeaviate() { config.setGRPCHost(weaviate.getGrpcHostAddress()); WeaviateClient client = new WeaviateClient(config); Result meta = client.misc().metaGetter().run(); - assertThat(meta.getResult().getVersion()).isEqualTo("1.24.5"); + assertThat(meta.getResult().getVersion()).isEqualTo("1.25.5"); } } @@ -43,13 +43,13 @@ public void testWeaviateWithModules() { Map 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 = 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()