Skip to content

Qdrant Module

Qdrant is an open-source, high-performance vector search engine/database. It provides a production-ready service with a convenient API to store, search, and manage points (i.e. vectors) with an additional payload.

Install

npm install @testcontainers/qdrant --save-dev

Examples

it("should connect to the client", async () => {
  const container = await new QdrantContainer().start();

  const client = new QdrantClient({ url: `http://${container.getRestHostAddress()}` });

  expect((await client.getCollections()).collections.length).toBe(0);

  await container.stop();
});
it("should work with valid API keys", async () => {
  const apiKey = crypto.randomUUID();

  const container = await new QdrantContainer().withApiKey(apiKey).start();

  const client = new QdrantClient({ url: `http://${container.getRestHostAddress()}`, apiKey });

  expect((await client.getCollections()).collections.length).toBe(0);

  await container.stop();
});
it("should work with config files - valid API key", async () => {
  const container = await new QdrantContainer().withConfigFile(path.resolve(__dirname, "test_config.yaml")).start();

  const client = new QdrantClient({ url: `http://${container.getRestHostAddress()}`, apiKey: "SOME_TEST_KEY" });

  expect((await client.getCollections()).collections.length).toBe(0);

  await container.stop();
});