UNPKG

@testcontainers/qdrant

Version:
69 lines 2.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StartedQdrantContainer = exports.QdrantContainer = void 0; const testcontainers_1 = require("testcontainers"); const QDRANT_REST_PORT = 6333; const QDRANT_GRPC_PORT = 6334; const QDRANT_CONFIG_FILE_PATH = "/qdrant/config/config.yaml"; class QdrantContainer extends testcontainers_1.GenericContainer { apiKey; configFilePath; constructor(image) { super(image); this.withExposedPorts(QDRANT_REST_PORT, QDRANT_GRPC_PORT); this.withWaitStrategy(testcontainers_1.Wait.forAll([ testcontainers_1.Wait.forLogMessage(/Actix runtime found; starting in Actix runtime/), testcontainers_1.Wait.forHttp("/readyz", QDRANT_REST_PORT), ])); } withApiKey(apiKey) { this.apiKey = apiKey; return this; } withConfigFile(configFile) { this.configFilePath = configFile; return this; } async start() { if (this.apiKey) { this.withEnvironment({ QDRANT__SERVICE__API_KEY: this.apiKey, }); } if (this.configFilePath) { this.withBindMounts([ { target: QDRANT_CONFIG_FILE_PATH, source: this.configFilePath, }, ]); } return new StartedQdrantContainer(await super.start()); } } exports.QdrantContainer = QdrantContainer; class StartedQdrantContainer extends testcontainers_1.AbstractStartedContainer { startedTestContainer; _restPort; get restPort() { return this._restPort; } _grpcPort; get grpcPort() { return this._grpcPort; } constructor(startedTestContainer) { super(startedTestContainer); this.startedTestContainer = startedTestContainer; this._restPort = this.getMappedPort(QDRANT_REST_PORT); this._grpcPort = this.getMappedPort(QDRANT_GRPC_PORT); } getRestHostAddress() { return `${this.getHost()}:${this.restPort}`; } getGrpcHostAddress() { return `${this.getHost()}:${this.grpcPort}`; } } exports.StartedQdrantContainer = StartedQdrantContainer; //# sourceMappingURL=qdrant-container.js.map