testcontainers
Version:
Testcontainers is a NodeJS library that supports tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container
44 lines (43 loc) • 2.05 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import { RestartOptions, StartedTestContainer, StopOptions, StoppedTestContainer } from "../test-container";
import Dockerode, { ContainerInspectInfo } from "dockerode";
import { ContentToCopy, DirectoryToCopy, ExecOptions, ExecResult, FileToCopy, Labels } from "../types";
import { Readable } from "stream";
import { WaitStrategy } from "../wait-strategies/wait-strategy";
import { BoundPorts } from "../utils/bound-ports";
export declare class StartedGenericContainer implements StartedTestContainer {
private readonly container;
private readonly host;
private inspectResult;
private boundPorts;
private readonly name;
private readonly waitStrategy;
private stoppedContainer?;
private stopContainerLock;
constructor(container: Dockerode.Container, host: string, inspectResult: ContainerInspectInfo, boundPorts: BoundPorts, name: string, waitStrategy: WaitStrategy);
protected containerIsStopping?(): Promise<void>;
stop(options?: Partial<StopOptions>): Promise<StoppedTestContainer>;
protected containerIsStopped?(): Promise<void>;
restart(options?: Partial<RestartOptions>): Promise<void>;
private stopContainer;
getHost(): string;
getFirstMappedPort(): number;
getMappedPort(port: number): number;
getId(): string;
getName(): string;
getLabels(): Labels;
getNetworkNames(): string[];
getNetworkId(networkName: string): string;
getIpAddress(networkName: string): string;
private getNetworkSettings;
copyFilesToContainer(filesToCopy: FileToCopy[]): Promise<void>;
copyDirectoriesToContainer(directoriesToCopy: DirectoryToCopy[]): Promise<void>;
copyContentToContainer(contentsToCopy: ContentToCopy[]): Promise<void>;
copyArchiveFromContainer(path: string): Promise<NodeJS.ReadableStream>;
exec(command: string | string[], opts?: Partial<ExecOptions>): Promise<ExecResult>;
logs(opts?: {
since?: number;
tail?: number;
}): Promise<Readable>;
}