import type { Readable } from "node:stream"; import type { StartedNetwork } from "./network/network"; import type { ArchiveToCopy, BindMount, CommitOptions, ContentToCopy, CopyToContainerOptions, DirectoryToCopy, Environment, ExecOptions, ExecResult, ExtraHost, FileToCopy, HealthCheck, Labels, ResourcesQuota, TmpFs, Ulimits } from "./types"; import type { PortWithOptionalBinding } from "./utils/port"; import type { ImagePullPolicy } from "./utils/pull-policy"; import type { WaitStrategy } from "./wait-strategies/wait-strategy"; export interface TestContainer { start(): Promise; withEnvironment(environment: Environment): this; withCommand(command: string[]): this; withEntrypoint(entrypoint: string[]): this; withName(name: string): this; withLabels(labels: Labels): this; withTmpFs(tmpFs: TmpFs): this; withUlimits(ulimits: Ulimits): this; withSecurityOpt(...securityOptions: string[]): this; withAddedCapabilities(...capabilities: string[]): this; withDroppedCapabilities(...capabilities: string[]): this; withExposedPorts(...ports: PortWithOptionalBinding[]): this; withBindMounts(bindMounts: BindMount[]): this; withHealthCheck(healthCheck: HealthCheck): this; withWaitStrategy(waitStrategy: WaitStrategy): this; withStartupTimeout(startupTimeoutMs: number): this; withNetwork(network: StartedNetwork): this; withNetworkMode(networkMode: string): this; withNetworkAliases(...networkAliases: string[]): this; withExtraHosts(extraHosts: ExtraHost[]): this; withDefaultLogDriver(): this; withPrivilegedMode(): this; withPlatform(platform: string): this; withUser(user: string): this; withPullPolicy(pullPolicy: ImagePullPolicy): this; withIpcMode(ipcMode: string): this; withReuse(): this; withAutoCleanup(autoCleanup: boolean): this; withAutoRemove(autoRemove: boolean): this; withCopyFilesToContainer(filesToCopy: FileToCopy[]): this; withCopyDirectoriesToContainer(directoriesToCopy: DirectoryToCopy[]): this; withCopyContentToContainer(contentsToCopy: ContentToCopy[]): this; withCopyArchivesToContainer(archivesToCopy: ArchiveToCopy[]): this; withCopyToContainerOptions(copyToContainerOptions: CopyToContainerOptions): this; withWorkingDir(workingDir: string): this; withResourcesQuota(resourcesQuota: ResourcesQuota): this; withSharedMemorySize(bytes: number): this; withLogConsumer(logConsumer: (stream: Readable) => unknown): this; withHostname(hostname: string): this; } export interface RestartOptions { timeout: number; } export interface StopOptions { timeout: number; remove: boolean; removeVolumes: boolean; } export interface StartedTestContainer extends AsyncDisposable { stop(options?: Partial): Promise; restart(options?: Partial): Promise; commit(options: CommitOptions): Promise; getHost(): string; getHostname(): string; getFirstMappedPort(): number; getMappedPort(port: number, protocol?: string): number; getMappedPort(portWithProtocol: `${number}/${"tcp" | "udp"}`): number; getName(): string; getLabels(): Labels; getId(): string; getNetworkNames(): string[]; getNetworkId(networkName: string): string; getIpAddress(networkName: string): string; copyArchiveFromContainer(path: string): Promise; copyArchiveToContainer(tar: Readable, target?: string, options?: CopyToContainerOptions): Promise; copyDirectoriesToContainer(directoriesToCopy: DirectoryToCopy[]): Promise; copyFilesToContainer(filesToCopy: FileToCopy[]): Promise; copyContentToContainer(contentsToCopy: ContentToCopy[]): Promise; exec(command: string | string[], opts?: Partial): Promise; logs(opts?: { since?: number; tail?: number; }): Promise; } export interface StoppedTestContainer { getId(): string; copyArchiveFromContainer(path: string): Promise; }