testcontainers 11.11.0 → 11.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/common/clock.js +0 -1
- package/build/common/file-lock.js +0 -1
- package/build/common/hash.js +0 -1
- package/build/common/index.js +0 -1
- package/build/common/logger.js +0 -1
- package/build/common/retry.js +0 -1
- package/build/common/streams.js +0 -1
- package/build/common/time.js +0 -1
- package/build/common/type-guards.js +0 -1
- package/build/common/uuid.js +0 -1
- package/build/container-runtime/auth/auths.js +0 -1
- package/build/container-runtime/auth/cred-helpers.js +0 -1
- package/build/container-runtime/auth/credential-provider.js +0 -1
- package/build/container-runtime/auth/creds-store.js +0 -1
- package/build/container-runtime/auth/get-auth-config.js +0 -1
- package/build/container-runtime/auth/registry-auth-locator.js +0 -1
- package/build/container-runtime/auth/registry-matches.js +0 -1
- package/build/container-runtime/auth/types.js +0 -1
- package/build/container-runtime/clients/client.js +0 -1
- package/build/container-runtime/clients/compose/compose-client.js +0 -1
- package/build/container-runtime/clients/compose/default-compose-options.js +0 -1
- package/build/container-runtime/clients/compose/parse-compose-container-name.js +2 -3
- package/build/container-runtime/clients/compose/types.js +0 -1
- package/build/container-runtime/clients/container/container-client.d.ts +2 -1
- package/build/container-runtime/clients/container/container-client.js +0 -1
- package/build/container-runtime/clients/container/docker-container-client.d.ts +2 -1
- package/build/container-runtime/clients/container/docker-container-client.js +6 -3
- package/build/container-runtime/clients/container/types.js +0 -1
- package/build/container-runtime/clients/image/docker-image-client.d.ts +3 -1
- package/build/container-runtime/clients/image/docker-image-client.js +36 -17
- package/build/container-runtime/clients/image/image-client.js +0 -1
- package/build/container-runtime/clients/network/docker-network-client.js +0 -1
- package/build/container-runtime/clients/network/network-client.js +0 -1
- package/build/container-runtime/clients/types.js +0 -1
- package/build/container-runtime/image-name.js +0 -1
- package/build/container-runtime/index.js +0 -1
- package/build/container-runtime/strategies/configuration-strategy.js +0 -1
- package/build/container-runtime/strategies/npipe-socket-strategy.js +0 -1
- package/build/container-runtime/strategies/rootless-unix-socket-strategy.js +0 -1
- package/build/container-runtime/strategies/strategy.js +0 -1
- package/build/container-runtime/strategies/testcontainers-host-strategy.js +0 -1
- package/build/container-runtime/strategies/types.js +0 -1
- package/build/container-runtime/strategies/unix-socket-strategy.js +0 -1
- package/build/container-runtime/strategies/utils/config.js +1 -2
- package/build/container-runtime/utils/attach-container.js +0 -1
- package/build/container-runtime/utils/demux-stream.js +0 -1
- package/build/container-runtime/utils/image-exists.js +0 -1
- package/build/container-runtime/utils/lookup-host-ips.js +0 -1
- package/build/container-runtime/utils/pull-image.js +0 -1
- package/build/container-runtime/utils/remote-container-runtime-socket-path.js +0 -1
- package/build/container-runtime/utils/resolve-host.js +0 -1
- package/build/container-runtime/utils/run-in-container.js +0 -1
- package/build/container-runtime/utils/start-container.js +0 -1
- package/build/docker-compose-environment/docker-compose-environment.d.ts +1 -0
- package/build/docker-compose-environment/docker-compose-environment.js +8 -1
- package/build/docker-compose-environment/downed-docker-compose-environment.js +0 -1
- package/build/docker-compose-environment/started-docker-compose-environment.js +0 -1
- package/build/docker-compose-environment/stopped-docker-compose-environment.js +0 -1
- package/build/generic-container/abstract-started-container.d.ts +2 -2
- package/build/generic-container/abstract-started-container.js +2 -3
- package/build/generic-container/abstract-stopped-container.js +0 -1
- package/build/generic-container/generic-container-builder.js +0 -1
- package/build/generic-container/generic-container.d.ts +4 -1
- package/build/generic-container/generic-container.js +23 -7
- package/build/generic-container/inspect-container-util-ports-exposed.js +0 -1
- package/build/generic-container/started-generic-container.d.ts +2 -2
- package/build/generic-container/started-generic-container.js +8 -4
- package/build/generic-container/stopped-generic-container.js +0 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +0 -1
- package/build/network/network.js +0 -1
- package/build/port-forwarder/port-forwarder.js +0 -1
- package/build/reaper/reaper.js +21 -11
- package/build/socat/socat-container.js +0 -1
- package/build/test-container.d.ts +4 -2
- package/build/test-container.js +0 -1
- package/build/test-containers.js +0 -1
- package/build/types.d.ts +14 -0
- package/build/types.js +0 -1
- package/build/utils/bound-ports.js +0 -1
- package/build/utils/dockerfile-parser.js +0 -1
- package/build/utils/labels.js +0 -1
- package/build/utils/map-inspect-result.js +0 -1
- package/build/utils/port-generator.js +0 -1
- package/build/utils/port.js +0 -1
- package/build/utils/pull-policy.js +0 -1
- package/build/version.d.ts +1 -1
- package/build/version.js +1 -2
- package/build/wait-strategies/composite-wait-strategy.js +0 -1
- package/build/wait-strategies/health-check-wait-strategy.js +0 -1
- package/build/wait-strategies/host-port-wait-strategy.js +0 -1
- package/build/wait-strategies/http-wait-strategy.js +0 -1
- package/build/wait-strategies/log-wait-strategy.js +0 -1
- package/build/wait-strategies/one-shot-startup-startegy.js +0 -1
- package/build/wait-strategies/shell-wait-strategy.js +0 -1
- package/build/wait-strategies/startup-check-strategy.js +0 -1
- package/build/wait-strategies/utils/port-check.js +0 -1
- package/build/wait-strategies/utils/undici-response-parser.js +0 -1
- package/build/wait-strategies/wait-for-container.js +0 -1
- package/build/wait-strategies/wait-strategy.js +0 -1
- package/build/wait-strategies/wait.js +0 -1
- package/package.json +6 -6
- package/build/common/clock.js.map +0 -1
- package/build/common/file-lock.js.map +0 -1
- package/build/common/hash.js.map +0 -1
- package/build/common/index.js.map +0 -1
- package/build/common/logger.js.map +0 -1
- package/build/common/retry.js.map +0 -1
- package/build/common/streams.js.map +0 -1
- package/build/common/time.js.map +0 -1
- package/build/common/type-guards.js.map +0 -1
- package/build/common/uuid.js.map +0 -1
- package/build/container-runtime/auth/auths.js.map +0 -1
- package/build/container-runtime/auth/cred-helpers.js.map +0 -1
- package/build/container-runtime/auth/credential-provider.js.map +0 -1
- package/build/container-runtime/auth/creds-store.js.map +0 -1
- package/build/container-runtime/auth/get-auth-config.js.map +0 -1
- package/build/container-runtime/auth/registry-auth-locator.js.map +0 -1
- package/build/container-runtime/auth/registry-matches.js.map +0 -1
- package/build/container-runtime/auth/types.js.map +0 -1
- package/build/container-runtime/clients/client.js.map +0 -1
- package/build/container-runtime/clients/compose/compose-client.js.map +0 -1
- package/build/container-runtime/clients/compose/default-compose-options.js.map +0 -1
- package/build/container-runtime/clients/compose/parse-compose-container-name.js.map +0 -1
- package/build/container-runtime/clients/compose/types.js.map +0 -1
- package/build/container-runtime/clients/container/container-client.js.map +0 -1
- package/build/container-runtime/clients/container/docker-container-client.js.map +0 -1
- package/build/container-runtime/clients/container/types.js.map +0 -1
- package/build/container-runtime/clients/image/docker-image-client.js.map +0 -1
- package/build/container-runtime/clients/image/image-client.js.map +0 -1
- package/build/container-runtime/clients/network/docker-network-client.js.map +0 -1
- package/build/container-runtime/clients/network/network-client.js.map +0 -1
- package/build/container-runtime/clients/types.js.map +0 -1
- package/build/container-runtime/image-name.js.map +0 -1
- package/build/container-runtime/index.js.map +0 -1
- package/build/container-runtime/strategies/configuration-strategy.js.map +0 -1
- package/build/container-runtime/strategies/npipe-socket-strategy.js.map +0 -1
- package/build/container-runtime/strategies/rootless-unix-socket-strategy.js.map +0 -1
- package/build/container-runtime/strategies/strategy.js.map +0 -1
- package/build/container-runtime/strategies/testcontainers-host-strategy.js.map +0 -1
- package/build/container-runtime/strategies/types.js.map +0 -1
- package/build/container-runtime/strategies/unix-socket-strategy.js.map +0 -1
- package/build/container-runtime/strategies/utils/config.js.map +0 -1
- package/build/container-runtime/utils/attach-container.js.map +0 -1
- package/build/container-runtime/utils/demux-stream.js.map +0 -1
- package/build/container-runtime/utils/image-exists.js.map +0 -1
- package/build/container-runtime/utils/lookup-host-ips.js.map +0 -1
- package/build/container-runtime/utils/pull-image.js.map +0 -1
- package/build/container-runtime/utils/remote-container-runtime-socket-path.js.map +0 -1
- package/build/container-runtime/utils/resolve-host.js.map +0 -1
- package/build/container-runtime/utils/run-in-container.js.map +0 -1
- package/build/container-runtime/utils/start-container.js.map +0 -1
- package/build/docker-compose-environment/docker-compose-environment.js.map +0 -1
- package/build/docker-compose-environment/downed-docker-compose-environment.js.map +0 -1
- package/build/docker-compose-environment/started-docker-compose-environment.js.map +0 -1
- package/build/docker-compose-environment/stopped-docker-compose-environment.js.map +0 -1
- package/build/generic-container/abstract-started-container.js.map +0 -1
- package/build/generic-container/abstract-stopped-container.js.map +0 -1
- package/build/generic-container/generic-container-builder.js.map +0 -1
- package/build/generic-container/generic-container.js.map +0 -1
- package/build/generic-container/inspect-container-util-ports-exposed.js.map +0 -1
- package/build/generic-container/started-generic-container.js.map +0 -1
- package/build/generic-container/stopped-generic-container.js.map +0 -1
- package/build/index.js.map +0 -1
- package/build/network/network.js.map +0 -1
- package/build/port-forwarder/port-forwarder.js.map +0 -1
- package/build/reaper/reaper.js.map +0 -1
- package/build/socat/socat-container.js.map +0 -1
- package/build/test-container.js.map +0 -1
- package/build/test-containers.js.map +0 -1
- package/build/types.js.map +0 -1
- package/build/utils/bound-ports.js.map +0 -1
- package/build/utils/dockerfile-parser.js.map +0 -1
- package/build/utils/labels.js.map +0 -1
- package/build/utils/map-inspect-result.js.map +0 -1
- package/build/utils/port-generator.js.map +0 -1
- package/build/utils/port.js.map +0 -1
- package/build/utils/pull-policy.js.map +0 -1
- package/build/version.js.map +0 -1
- package/build/wait-strategies/composite-wait-strategy.js.map +0 -1
- package/build/wait-strategies/health-check-wait-strategy.js.map +0 -1
- package/build/wait-strategies/host-port-wait-strategy.js.map +0 -1
- package/build/wait-strategies/http-wait-strategy.js.map +0 -1
- package/build/wait-strategies/log-wait-strategy.js.map +0 -1
- package/build/wait-strategies/one-shot-startup-startegy.js.map +0 -1
- package/build/wait-strategies/shell-wait-strategy.js.map +0 -1
- package/build/wait-strategies/startup-check-strategy.js.map +0 -1
- package/build/wait-strategies/utils/port-check.js.map +0 -1
- package/build/wait-strategies/utils/undici-response-parser.js.map +0 -1
- package/build/wait-strategies/wait-for-container.js.map +0 -1
- package/build/wait-strategies/wait-strategy.js.map +0 -1
- package/build/wait-strategies/wait.js.map +0 -1
package/build/common/clock.js
CHANGED
package/build/common/hash.js
CHANGED
package/build/common/index.js
CHANGED
|
@@ -36,4 +36,3 @@ __exportStar(require("./type-guards"), exports);
|
|
|
36
36
|
var uuid_1 = require("./uuid");
|
|
37
37
|
Object.defineProperty(exports, "RandomUuid", { enumerable: true, get: function () { return uuid_1.RandomUuid; } });
|
|
38
38
|
Object.defineProperty(exports, "randomUuid", { enumerable: true, get: function () { return uuid_1.randomUuid; } });
|
|
39
|
-
//# sourceMappingURL=index.js.map
|
package/build/common/logger.js
CHANGED
|
@@ -54,4 +54,3 @@ exports.composeLog = new Logger("testcontainers:compose", false);
|
|
|
54
54
|
exports.buildLog = new Logger("testcontainers:build", false);
|
|
55
55
|
exports.pullLog = new Logger("testcontainers:pull", false);
|
|
56
56
|
exports.execLog = new Logger("testcontainers:exec", false);
|
|
57
|
-
//# sourceMappingURL=logger.js.map
|
package/build/common/retry.js
CHANGED
package/build/common/streams.js
CHANGED
package/build/common/time.js
CHANGED
package/build/common/uuid.js
CHANGED
|
@@ -3,4 +3,3 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.registryMatches = void 0;
|
|
4
4
|
const registryMatches = (authConfigRegistry, requestedRegistry) => authConfigRegistry == requestedRegistry || authConfigRegistry.endsWith("://" + requestedRegistry);
|
|
5
5
|
exports.registryMatches = registryMatches;
|
|
6
|
-
//# sourceMappingURL=registry-matches.js.map
|
|
@@ -117,4 +117,3 @@ async function initStrategy(strategy) {
|
|
|
117
117
|
common_1.log.trace(`Container runtime info:\n${JSON.stringify(info, null, 2)}`);
|
|
118
118
|
return new ContainerRuntimeClient(info, composeClient, containerClient, imageClient, networkClient);
|
|
119
119
|
}
|
|
120
|
-
//# sourceMappingURL=client.js.map
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseComposeContainerName = parseComposeContainerName;
|
|
4
4
|
function parseComposeContainerName(projectName, containerName) {
|
|
5
|
-
if (containerName.
|
|
6
|
-
return containerName.substring(`/${projectName}
|
|
5
|
+
if (containerName.startsWith(`/${projectName}-`)) {
|
|
6
|
+
return containerName.substring(`/${projectName}-`.length);
|
|
7
7
|
}
|
|
8
8
|
else if (containerName.startsWith("/")) {
|
|
9
9
|
return containerName.substring(1);
|
|
@@ -12,4 +12,3 @@ function parseComposeContainerName(projectName, containerName) {
|
|
|
12
12
|
throw new Error(`Unable to resolve container name for container name: "${containerName}", project name: "${projectName}"`);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
//# sourceMappingURL=parse-compose-container-name.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Dockerode, { Container, ContainerCreateOptions, ContainerInfo, ContainerInspectInfo, ContainerLogsOptions, Network } from "dockerode";
|
|
2
2
|
import { Readable } from "stream";
|
|
3
|
+
import { CopyToContainerOptions } from "../../../types";
|
|
3
4
|
import { ContainerCommitOptions, ContainerStatus, ExecOptions, ExecResult } from "./types";
|
|
4
5
|
export interface ContainerClient {
|
|
5
6
|
dockerode: Dockerode;
|
|
@@ -8,7 +9,7 @@ export interface ContainerClient {
|
|
|
8
9
|
status?: ContainerStatus[];
|
|
9
10
|
}): Promise<Container | undefined>;
|
|
10
11
|
fetchArchive(container: Container, path: string): Promise<NodeJS.ReadableStream>;
|
|
11
|
-
putArchive(container: Dockerode.Container, stream: Readable, path: string): Promise<void>;
|
|
12
|
+
putArchive(container: Dockerode.Container, stream: Readable, path: string, options?: CopyToContainerOptions): Promise<void>;
|
|
12
13
|
list(): Promise<ContainerInfo[]>;
|
|
13
14
|
create(opts: ContainerCreateOptions): Promise<Container>;
|
|
14
15
|
start(container: Container): Promise<void>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Dockerode, { Container, ContainerCreateOptions, ContainerInfo, ContainerInspectInfo, ContainerLogsOptions, Network } from "dockerode";
|
|
2
2
|
import { Readable } from "stream";
|
|
3
|
+
import { CopyToContainerOptions } from "../../../types";
|
|
3
4
|
import { ContainerClient } from "./container-client";
|
|
4
5
|
import { ContainerCommitOptions, ContainerStatus, ExecOptions, ExecResult } from "./types";
|
|
5
6
|
export declare class DockerContainerClient implements ContainerClient {
|
|
@@ -10,7 +11,7 @@ export declare class DockerContainerClient implements ContainerClient {
|
|
|
10
11
|
status?: ContainerStatus[];
|
|
11
12
|
} | undefined): Promise<Container | undefined>;
|
|
12
13
|
fetchArchive(container: Container, path: string): Promise<NodeJS.ReadableStream>;
|
|
13
|
-
putArchive(container: Dockerode.Container, stream: Readable, path: string): Promise<void>;
|
|
14
|
+
putArchive(container: Dockerode.Container, stream: Readable, path: string, options?: CopyToContainerOptions): Promise<void>;
|
|
14
15
|
list(): Promise<ContainerInfo[]>;
|
|
15
16
|
create(opts: ContainerCreateOptions): Promise<Container>;
|
|
16
17
|
start(container: Container): Promise<void>;
|
|
@@ -59,10 +59,14 @@ class DockerContainerClient {
|
|
|
59
59
|
throw err;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
async putArchive(container, stream, path) {
|
|
62
|
+
async putArchive(container, stream, path, options) {
|
|
63
63
|
try {
|
|
64
64
|
common_1.log.debug(`Putting archive to container...`, { containerId: container.id });
|
|
65
|
-
await (0, common_1.streamToString)(stream_1.Readable.from(await container.putArchive(stream, {
|
|
65
|
+
await (0, common_1.streamToString)(stream_1.Readable.from(await container.putArchive(stream, {
|
|
66
|
+
path,
|
|
67
|
+
noOverwriteDirNonDir: options?.noOverwriteDirNonDir,
|
|
68
|
+
copyUIDGID: options?.copyUIDGID,
|
|
69
|
+
})));
|
|
66
70
|
common_1.log.debug(`Put archive to container`, { containerId: container.id });
|
|
67
71
|
}
|
|
68
72
|
catch (err) {
|
|
@@ -312,4 +316,3 @@ class DockerContainerClient {
|
|
|
312
316
|
}
|
|
313
317
|
}
|
|
314
318
|
exports.DockerContainerClient = DockerContainerClient;
|
|
315
|
-
//# sourceMappingURL=docker-container-client.js.map
|
|
@@ -8,7 +8,9 @@ export declare class DockerImageClient implements ImageClient {
|
|
|
8
8
|
private readonly imageExistsLock;
|
|
9
9
|
constructor(dockerode: Dockerode, indexServerAddress: string);
|
|
10
10
|
build(context: string, opts: ImageBuildOptions): Promise<void>;
|
|
11
|
-
private
|
|
11
|
+
private createTarPackOptions;
|
|
12
|
+
private listContextEntries;
|
|
13
|
+
private normalizePathForDockerIgnore;
|
|
12
14
|
inspect(imageName: ImageName): Promise<ImageInspectInfo>;
|
|
13
15
|
exists(imageName: ImageName): Promise<boolean>;
|
|
14
16
|
pull(imageName: ImageName, opts?: {
|
|
@@ -24,18 +24,8 @@ class DockerImageClient {
|
|
|
24
24
|
async build(context, opts) {
|
|
25
25
|
try {
|
|
26
26
|
common_1.log.debug(`Building image "${opts.t}" with context "${context}"...`);
|
|
27
|
-
const
|
|
28
|
-
const tarStream = tar_fs_1.default.pack(context,
|
|
29
|
-
ignore: (aPath) => {
|
|
30
|
-
const relativePath = path_1.default.relative(context, aPath);
|
|
31
|
-
if (relativePath === opts.dockerfile) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
return isDockerIgnored(relativePath);
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
});
|
|
27
|
+
const tarPackOptions = await this.createTarPackOptions(context, opts.dockerfile ?? "Dockerfile");
|
|
28
|
+
const tarStream = tar_fs_1.default.pack(context, tarPackOptions);
|
|
39
29
|
await new Promise((resolve) => {
|
|
40
30
|
this.dockerode
|
|
41
31
|
.buildImage(tarStream, opts)
|
|
@@ -57,16 +47,46 @@ class DockerImageClient {
|
|
|
57
47
|
throw err;
|
|
58
48
|
}
|
|
59
49
|
}
|
|
60
|
-
async
|
|
50
|
+
async createTarPackOptions(context, dockerfileName) {
|
|
61
51
|
const dockerIgnoreFilePath = path_1.default.join(context, ".dockerignore");
|
|
62
52
|
if (!(0, fs_1.existsSync)(dockerIgnoreFilePath)) {
|
|
63
|
-
return
|
|
53
|
+
return {};
|
|
64
54
|
}
|
|
65
55
|
const dockerIgnorePatterns = await fs_1.promises.readFile(dockerIgnoreFilePath, { encoding: "utf-8" });
|
|
66
56
|
const instance = (0, dockerignore_1.default)({ ignorecase: false });
|
|
67
57
|
instance.add(dockerIgnorePatterns);
|
|
68
|
-
const
|
|
69
|
-
|
|
58
|
+
const allEntries = await this.listContextEntries(context);
|
|
59
|
+
const includedEntries = instance.filter(allEntries);
|
|
60
|
+
const dockerfilePath = this.normalizePathForDockerIgnore(path_1.default.normalize(dockerfileName));
|
|
61
|
+
if (!includedEntries.includes(dockerfilePath)) {
|
|
62
|
+
includedEntries.push(dockerfilePath);
|
|
63
|
+
}
|
|
64
|
+
return { entries: includedEntries };
|
|
65
|
+
}
|
|
66
|
+
async listContextEntries(context) {
|
|
67
|
+
const entries = [];
|
|
68
|
+
const directoriesToVisit = [""];
|
|
69
|
+
while (directoriesToVisit.length > 0) {
|
|
70
|
+
const directory = directoriesToVisit.pop();
|
|
71
|
+
if (directory === undefined) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const absoluteDirectory = directory.length > 0 ? path_1.default.join(context, directory) : context;
|
|
75
|
+
const directoryEntries = await fs_1.promises.readdir(absoluteDirectory, { withFileTypes: true });
|
|
76
|
+
for (const directoryEntry of directoryEntries) {
|
|
77
|
+
const relativeEntry = directory.length > 0 ? path_1.default.join(directory, directoryEntry.name) : directoryEntry.name;
|
|
78
|
+
if (directoryEntry.isDirectory()) {
|
|
79
|
+
directoriesToVisit.push(relativeEntry);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
entries.push(this.normalizePathForDockerIgnore(relativeEntry));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return entries;
|
|
87
|
+
}
|
|
88
|
+
normalizePathForDockerIgnore(aPath) {
|
|
89
|
+
return aPath.replace(/\\/gu, "/");
|
|
70
90
|
}
|
|
71
91
|
async inspect(imageName) {
|
|
72
92
|
try {
|
|
@@ -131,4 +151,3 @@ class DockerImageClient {
|
|
|
131
151
|
}
|
|
132
152
|
}
|
|
133
153
|
exports.DockerImageClient = DockerImageClient;
|
|
134
|
-
//# sourceMappingURL=docker-image-client.js.map
|
|
@@ -10,4 +10,3 @@ var parse_compose_container_name_1 = require("./clients/compose/parse-compose-co
|
|
|
10
10
|
Object.defineProperty(exports, "parseComposeContainerName", { enumerable: true, get: function () { return parse_compose_container_name_1.parseComposeContainerName; } });
|
|
11
11
|
var image_name_1 = require("./image-name");
|
|
12
12
|
Object.defineProperty(exports, "ImageName", { enumerable: true, get: function () { return image_name_1.ImageName; } });
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -28,7 +28,7 @@ async function loadFromFile() {
|
|
|
28
28
|
if ((0, fs_1.existsSync)(file)) {
|
|
29
29
|
common_1.log.debug(`Loading ".testcontainers.properties" file...`);
|
|
30
30
|
const string = await (0, promises_1.readFile)(file, { encoding: "utf-8" });
|
|
31
|
-
const properties = (0, properties_reader_1.default)("").read(string);
|
|
31
|
+
const properties = (0, properties_reader_1.default)({ sourceFile: "" }).read(string);
|
|
32
32
|
const tcHost = properties.get("tc.host");
|
|
33
33
|
if (tcHost !== null) {
|
|
34
34
|
dockerClientConfig.tcHost = tcHost;
|
|
@@ -73,4 +73,3 @@ function logDockerClientConfig(config) {
|
|
|
73
73
|
common_1.log.debug(`Found custom configuration: ${configurations.join(", ")}`);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
//# sourceMappingURL=config.js.map
|
|
@@ -20,4 +20,3 @@ const getRemoteContainerRuntimeSocketPath = (containerRuntimeStrategyResult, con
|
|
|
20
20
|
return platform === "win32" ? `/${socketPath}` : socketPath;
|
|
21
21
|
};
|
|
22
22
|
exports.getRemoteContainerRuntimeSocketPath = getRemoteContainerRuntimeSocketPath;
|
|
23
|
-
//# sourceMappingURL=remote-container-runtime-socket-path.js.map
|
|
@@ -31,4 +31,5 @@ export declare class DockerComposeEnvironment {
|
|
|
31
31
|
withProjectName(projectName: string): this;
|
|
32
32
|
withClientOptions(options: Partial<Omit<ComposeOptions, "filePath" | "files" | "projectName" | "environment">>): this;
|
|
33
33
|
up(services?: Array<string>): Promise<StartedDockerComposeEnvironment>;
|
|
34
|
+
private warnForUnusedWaitStrategies;
|
|
34
35
|
}
|
|
@@ -114,6 +114,8 @@ class DockerComposeEnvironment {
|
|
|
114
114
|
startedContainer.Names.join(", "),
|
|
115
115
|
], []);
|
|
116
116
|
common_1.log.info(`Started containers "${startedContainerNames.join('", "')}"`);
|
|
117
|
+
const startedContainerNameSet = new Set(startedContainers.map((startedContainer) => (0, container_runtime_1.parseComposeContainerName)(this.projectName, startedContainer.Names[0])));
|
|
118
|
+
this.warnForUnusedWaitStrategies(startedContainerNameSet);
|
|
117
119
|
const startedGenericContainers = (await Promise.all(startedContainers.map(async (startedContainer) => {
|
|
118
120
|
const container = client.container.getById(startedContainer.Id);
|
|
119
121
|
const containerName = (0, container_runtime_1.parseComposeContainerName)(this.projectName, startedContainer.Names[0]);
|
|
@@ -155,6 +157,11 @@ class DockerComposeEnvironment {
|
|
|
155
157
|
environment: this.environment,
|
|
156
158
|
});
|
|
157
159
|
}
|
|
160
|
+
warnForUnusedWaitStrategies(startedContainerNames) {
|
|
161
|
+
const unusedWaitStrategyContainerNames = Object.keys(this.waitStrategy).filter((configuredContainerName) => !startedContainerNames.has(configuredContainerName));
|
|
162
|
+
if (unusedWaitStrategyContainerNames.length > 0) {
|
|
163
|
+
common_1.log.warn(`No containers were started for the configured wait strategy names: "${unusedWaitStrategyContainerNames.join('", "')}". Wait strategies are matched against container names (for example "redis-1"), not service names.`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
158
166
|
}
|
|
159
167
|
exports.DockerComposeEnvironment = DockerComposeEnvironment;
|
|
160
|
-
//# sourceMappingURL=docker-compose-environment.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Readable } from "stream";
|
|
2
2
|
import { RestartOptions, StartedTestContainer, StopOptions, StoppedTestContainer } from "../test-container";
|
|
3
|
-
import { CommitOptions, ContentToCopy, DirectoryToCopy, ExecOptions, ExecResult, FileToCopy, Labels } from "../types";
|
|
3
|
+
import { CommitOptions, ContentToCopy, CopyToContainerOptions, DirectoryToCopy, ExecOptions, ExecResult, FileToCopy, Labels } from "../types";
|
|
4
4
|
export declare class AbstractStartedContainer implements StartedTestContainer {
|
|
5
5
|
protected readonly startedTestContainer: StartedTestContainer;
|
|
6
6
|
constructor(startedTestContainer: StartedTestContainer);
|
|
@@ -23,7 +23,7 @@ export declare class AbstractStartedContainer implements StartedTestContainer {
|
|
|
23
23
|
copyFilesToContainer(filesToCopy: FileToCopy[]): Promise<void>;
|
|
24
24
|
copyDirectoriesToContainer(directoriesToCopy: DirectoryToCopy[]): Promise<void>;
|
|
25
25
|
copyContentToContainer(contentsToCopy: ContentToCopy[]): Promise<void>;
|
|
26
|
-
copyArchiveToContainer(tar: Readable, target?: string): Promise<void>;
|
|
26
|
+
copyArchiveToContainer(tar: Readable, target?: string, options?: CopyToContainerOptions): Promise<void>;
|
|
27
27
|
copyArchiveFromContainer(path: string): Promise<NodeJS.ReadableStream>;
|
|
28
28
|
exec(command: string | string[], opts?: Partial<ExecOptions>): Promise<ExecResult>;
|
|
29
29
|
logs(opts?: {
|
|
@@ -64,8 +64,8 @@ class AbstractStartedContainer {
|
|
|
64
64
|
async copyContentToContainer(contentsToCopy) {
|
|
65
65
|
return this.startedTestContainer.copyContentToContainer(contentsToCopy);
|
|
66
66
|
}
|
|
67
|
-
copyArchiveToContainer(tar, target = "/") {
|
|
68
|
-
return this.startedTestContainer.copyArchiveToContainer(tar, target);
|
|
67
|
+
copyArchiveToContainer(tar, target = "/", options) {
|
|
68
|
+
return this.startedTestContainer.copyArchiveToContainer(tar, target, options);
|
|
69
69
|
}
|
|
70
70
|
copyArchiveFromContainer(path) {
|
|
71
71
|
return this.startedTestContainer.copyArchiveFromContainer(path);
|
|
@@ -81,4 +81,3 @@ class AbstractStartedContainer {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
exports.AbstractStartedContainer = AbstractStartedContainer;
|
|
84
|
-
//# sourceMappingURL=abstract-started-container.js.map
|
|
@@ -3,7 +3,7 @@ import { Readable } from "stream";
|
|
|
3
3
|
import { ImageName } from "../container-runtime";
|
|
4
4
|
import { StartedNetwork } from "../network/network";
|
|
5
5
|
import { StartedTestContainer, TestContainer } from "../test-container";
|
|
6
|
-
import { ArchiveToCopy, BindMount, ContentToCopy, DirectoryToCopy, Environment, ExtraHost, FileToCopy, HealthCheck, InspectResult, Labels, ResourcesQuota, TmpFs, Ulimits } from "../types";
|
|
6
|
+
import { ArchiveToCopy, BindMount, ContentToCopy, CopyToContainerOptions, DirectoryToCopy, Environment, ExtraHost, FileToCopy, HealthCheck, InspectResult, Labels, ResourcesQuota, TmpFs, Ulimits } from "../types";
|
|
7
7
|
import { PortWithOptionalBinding } from "../utils/port";
|
|
8
8
|
import { ImagePullPolicy } from "../utils/pull-policy";
|
|
9
9
|
import { WaitStrategy } from "../wait-strategies/wait-strategy";
|
|
@@ -27,6 +27,7 @@ export declare class GenericContainer implements TestContainer {
|
|
|
27
27
|
protected directoriesToCopy: DirectoryToCopy[];
|
|
28
28
|
protected contentsToCopy: ContentToCopy[];
|
|
29
29
|
protected archivesToCopy: ArchiveToCopy[];
|
|
30
|
+
protected copyToContainerOptions: CopyToContainerOptions;
|
|
30
31
|
protected healthCheck?: HealthCheck;
|
|
31
32
|
constructor(image: string);
|
|
32
33
|
private isHelperContainer;
|
|
@@ -49,6 +50,7 @@ export declare class GenericContainer implements TestContainer {
|
|
|
49
50
|
withPlatform(platform: string): this;
|
|
50
51
|
withTmpFs(tmpFs: TmpFs): this;
|
|
51
52
|
withUlimits(ulimits: Ulimits): this;
|
|
53
|
+
withSecurityOpt(...securityOptions: string[]): this;
|
|
52
54
|
withAddedCapabilities(...capabilities: string[]): this;
|
|
53
55
|
withDroppedCapabilities(...capabilities: string[]): this;
|
|
54
56
|
withNetwork(network: StartedNetwork): this;
|
|
@@ -71,6 +73,7 @@ export declare class GenericContainer implements TestContainer {
|
|
|
71
73
|
withCopyDirectoriesToContainer(directoriesToCopy: DirectoryToCopy[]): this;
|
|
72
74
|
withCopyContentToContainer(contentsToCopy: ContentToCopy[]): this;
|
|
73
75
|
withCopyArchivesToContainer(archivesToCopy: ArchiveToCopy[]): this;
|
|
76
|
+
withCopyToContainerOptions(copyToContainerOptions: CopyToContainerOptions): this;
|
|
74
77
|
withWorkingDir(workingDir: string): this;
|
|
75
78
|
withResourcesQuota({ memory, cpu }: ResourcesQuota): this;
|
|
76
79
|
withSharedMemorySize(bytes: number): this;
|