Skip to content

Milvus

Testcontainers module for Milvus.

Milvus's usage examples

You can start a Milvus container instance from any Java application by using:

MilvusContainer milvus = new MilvusContainer("milvusdb/milvus:v2.3.9")

With external Etcd:

Network network = Network.newNetwork();
GenericContainer<?> etcd = new GenericContainer<>("quay.io/coreos/etcd:v3.5.5")
    .withNetwork(network)
    .withNetworkAliases("etcd")
    .withCommand(
        "etcd",
        "-advertise-client-urls=http://127.0.0.1:2379",
        "-listen-client-urls=http://0.0.0.0:2379",
        "--data-dir=/etcd"
    )
    .withEnv("ETCD_AUTO_COMPACTION_MODE", "revision")
    .withEnv("ETCD_AUTO_COMPACTION_RETENTION", "1000")
    .withEnv("ETCD_QUOTA_BACKEND_BYTES", "4294967296")
    .withEnv("ETCD_SNAPSHOT_COUNT", "50000")
    .waitingFor(Wait.forLogMessage(".*ready to serve client requests.*", 1));
MilvusContainer milvus = new MilvusContainer("milvusdb/milvus:v2.3.9")
    .withNetwork(network)
    .withEtcdEndpoint("etcd:2379")
    .dependsOn(etcd)

Adding this module to your project dependencies

Add the following dependency to your pom.xml/build.gradle file:

testImplementation "org.testcontainers:milvus:1.19.7"
<dependency>
    <groupId>org.testcontainers</groupId>
    <artifactId>milvus</artifactId>
    <version>1.19.7</version>
    <scope>test</scope>
</dependency>