UNPKG

@testcontainers/weaviate

Version:
38 lines 1.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.StartedWeaviateContainer = exports.WeaviateContainer = void 0; const testcontainers_1 = require("testcontainers"); const WEAVIATE_HTTP_PORT = 8080; const WEAVIATE_GRPC_PORT = 50051; class WeaviateContainer extends testcontainers_1.GenericContainer { constructor(image) { super(image); this.withCommand(["--host", "0.0.0.0", "--scheme", "http", "--port", `${WEAVIATE_HTTP_PORT}`]); this.withExposedPorts(WEAVIATE_HTTP_PORT, WEAVIATE_GRPC_PORT); this.withEnvironment({ AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: "true", PERSISTENCE_DATA_PATH: "/var/lib/weaviate", }); this.withWaitStrategy(testcontainers_1.Wait.forAll([ testcontainers_1.Wait.forListeningPorts(), testcontainers_1.Wait.forHttp("/v1/.well-known/ready", WEAVIATE_HTTP_PORT), ]).withStartupTimeout(5_000)); } async start() { return new StartedWeaviateContainer(await super.start()); } } exports.WeaviateContainer = WeaviateContainer; class StartedWeaviateContainer extends testcontainers_1.AbstractStartedContainer { constructor(startedTestContainer) { super(startedTestContainer); } getHttpHostAddress() { return `${this.getHost()}:${this.getMappedPort(WEAVIATE_HTTP_PORT)}`; } getGrpcHostAddress() { return `${this.getHost()}:${this.getMappedPort(WEAVIATE_GRPC_PORT)}`; } } exports.StartedWeaviateContainer = StartedWeaviateContainer; //# sourceMappingURL=weaviate-container.js.map