Skip to content

Commit

Permalink
resolve issues with grpc dependency in milvus
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderankin committed Jan 6, 2024
1 parent 0e2e7a2 commit 32ddec4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions db/milvus/milvus-simple/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
dependencies {
// https://milvus.io/docs/install-java.md#Install-Milvus-Java-SDK-1
implementation 'io.milvus:milvus-sdk-java:2.3.3'
implementation 'io.grpc:grpc-netty:1.60.1' // issues in 1.46.0, which was default

implementation 'org.springframework.boot:spring-boot-starter-web'
itestImplementation 'org.springframework.boot:spring-boot-starter-test'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.github.dockerjava.api.model.HostConfig;
import io.milvus.client.MilvusServiceClient;
import io.milvus.param.collection.CreateDatabaseParam;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
Expand All @@ -20,8 +21,7 @@
import java.util.Objects;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.*;
import static org.springframework.http.HttpStatus.OK;

@SuppressWarnings("resource")
Expand All @@ -35,6 +35,8 @@ class MilvusSampleAppITest {
.withNetwork(NETWORK)
.withEnv("ALLOW_NONE_AUTHENTICATION", "yes")
.withExposedPorts(2379)
.waitingFor(Wait.forHttp("/metrics").forPort(2379))
.withLogConsumer(o -> System.out.print("ETCD: " + o.getUtf8String()))
.withNetworkAliases("etcd");
static GenericContainer<?> MINIO_CONTAINER =
new GenericContainer<>("minio/minio:RELEASE.2023-03-20T20-16-18Z")
Expand All @@ -43,6 +45,8 @@ class MilvusSampleAppITest {
.withEnv("MINIO_ROOT_PASSWORD", "minioadmin")
.withNetworkAliases("minio")
.withExposedPorts(9000, 9001)
.waitingFor(Wait.forHttp("/minio/health/live").forPort(9000))
.withLogConsumer(o -> System.out.print("MINIO: " + o.getUtf8String()))
.withCommand("minio server /minio_data --console-address :9001");
static GenericContainer<?> MILVUS_CONTAINER =
new GenericContainer<>("milvusdb/milvus:v2.3.3")
Expand All @@ -56,6 +60,7 @@ class MilvusSampleAppITest {
.withEnv("MINIO_SECRET_ACCESS_KEY", "minioadmin")
.waitingFor(Wait.forHttp("/healthz").forPort(9091))
.withCommand("milvus", "run", "standalone")
.withLogConsumer(o -> System.out.print("MILVUS: " + o.getUtf8String()))
.withCreateContainerCmdModifier(c ->
c.withHostConfig(Objects.requireNonNullElseGet(c.getHostConfig(), HostConfig::new)
.withSecurityOpts(List.of("seccomp:unconfined"))));
Expand All @@ -77,7 +82,16 @@ static void milvusPropertySource(DynamicPropertyRegistry registry) {
@Test
void test_client() {
// haven't figured this out yet
assertThat(milvusClient.checkHealth().getException(), is(notNullValue()));
assertThat(milvusClient.checkHealth().getException(), is(nullValue()));

assertThat(milvusClient.createDatabase(CreateDatabaseParam.newBuilder()
.withDatabaseName("testing_db")
.build()).getStatus(),
is(0));
assertThat(milvusClient.listDatabases()
.getData()
.getDbNamesList(),
hasItem("testing_db"));
}

@Test
Expand Down

0 comments on commit 32ddec4

Please sign in to comment.