Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions packages/modules/qdrant/src/qdrant-container.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("QdrantContainer", () => {

// connectQdrantSimple {
it("should connect to the client", async () => {
const container = await new QdrantContainer().start();
const container = await new QdrantContainer("qdrant/qdrant:v1.13.4").start();

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

Expand All @@ -22,7 +22,7 @@ describe("QdrantContainer", () => {
it("should work with valid API keys", async () => {
const apiKey = crypto.randomUUID();

const container = await new QdrantContainer().withApiKey(apiKey).start();
const container = await new QdrantContainer("qdrant/qdrant:v1.13.4").withApiKey(apiKey).start();

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

Expand All @@ -35,21 +35,23 @@ describe("QdrantContainer", () => {
it("should fail for invalid API keys", async () => {
const apiKey = crypto.randomUUID();

const container = await new QdrantContainer().withApiKey(apiKey).start();
const container = await new QdrantContainer("qdrant/qdrant:v1.13.4").withApiKey(apiKey).start();

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

expect(client.getCollections()).rejects.toThrow("Forbidden");
expect(client.getCollections()).rejects.toThrow("Unauthorized");

await container.stop();
});

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

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

Expand All @@ -60,14 +62,16 @@ describe("QdrantContainer", () => {
// }

it("should work with config files - invalid API key", async () => {
const container = await new QdrantContainer().withConfigFile(path.resolve(__dirname, "test_config.yaml")).start();
const container = await new QdrantContainer("qdrant/qdrant:v1.13.4")
.withConfigFile(path.resolve(__dirname, "test_config.yaml"))
.start();

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

expect(client.getCollections()).rejects.toThrow("Forbidden");
expect(client.getCollections()).rejects.toThrow("Unauthorized");

await container.stop();
});
Expand Down
2 changes: 1 addition & 1 deletion packages/modules/qdrant/src/qdrant-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class QdrantContainer extends GenericContainer {
private apiKey: string | undefined;
private configFilePath: string | undefined;

constructor(image = "qdrant/qdrant:v1.8.1") {
constructor(image = "qdrant/qdrant:v1.13.4") {
super(image);
this.withExposedPorts(QDRANT_REST_PORT, QDRANT_GRPC_PORT);
this.withWaitStrategy(
Expand Down