testcontainers 12.0.1 → 12.0.3
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/generic-container/generic-container.d.ts +1 -0
- package/build/generic-container/generic-container.js +5 -0
- package/build/port-forwarder/port-forwarder.js +1 -1
- package/build/utils/bound-ports.js +4 -5
- package/build/version.d.ts +1 -1
- package/build/version.js +1 -1
- package/build/wait-strategies/log-wait-strategy.js +3 -0
- package/package.json +3 -3
|
@@ -60,6 +60,7 @@ export declare class GenericContainer implements TestContainer {
|
|
|
60
60
|
withNetworkAliases(...networkAliases: string[]): this;
|
|
61
61
|
withExtraHosts(extraHosts: ExtraHost[]): this;
|
|
62
62
|
withExposedPorts(...ports: PortWithOptionalBinding[]): this;
|
|
63
|
+
protected hasExposedPort(port: PortWithOptionalBinding): boolean;
|
|
63
64
|
withBindMounts(bindMounts: BindMount[]): this;
|
|
64
65
|
withHealthCheck(healthCheck: HealthCheck): this;
|
|
65
66
|
withStartupTimeout(startupTimeoutMs: number): this;
|
|
@@ -305,6 +305,11 @@ class GenericContainer {
|
|
|
305
305
|
};
|
|
306
306
|
return this;
|
|
307
307
|
}
|
|
308
|
+
hasExposedPort(port) {
|
|
309
|
+
const containerPort = (0, port_1.getContainerPort)(port);
|
|
310
|
+
const protocol = (0, port_1.getProtocol)(port);
|
|
311
|
+
return Object.hasOwn(this.createOpts.ExposedPorts ?? {}, `${containerPort}/${protocol}`);
|
|
312
|
+
}
|
|
308
313
|
withBindMounts(bindMounts) {
|
|
309
314
|
this.hostConfig.Binds = bindMounts
|
|
310
315
|
.map((bindMount) => ({ mode: "rw", ...bindMount }))
|
|
@@ -9,7 +9,7 @@ const reaper_1 = require("../reaper/reaper");
|
|
|
9
9
|
const labels_1 = require("../utils/labels");
|
|
10
10
|
exports.SSHD_IMAGE = process.env["SSHD_CONTAINER_IMAGE"]
|
|
11
11
|
? container_runtime_1.ImageName.fromString(process.env["SSHD_CONTAINER_IMAGE"]).string
|
|
12
|
-
: container_runtime_1.ImageName.fromString("testcontainers/sshd:1.
|
|
12
|
+
: container_runtime_1.ImageName.fromString("testcontainers/sshd:1.4.0").string;
|
|
13
13
|
class PortForwarder {
|
|
14
14
|
sshConnection;
|
|
15
15
|
containerId;
|
|
@@ -49,17 +49,16 @@ class BoundPorts {
|
|
|
49
49
|
}
|
|
50
50
|
filter(ports) {
|
|
51
51
|
const boundPorts = new BoundPorts();
|
|
52
|
-
const containerPortsWithProtocol = new
|
|
52
|
+
const containerPortsWithProtocol = new Set();
|
|
53
53
|
ports.forEach((port) => {
|
|
54
54
|
const containerPort = (0, port_1.getContainerPort)(port);
|
|
55
|
-
const protocol = (0, port_1.getProtocol)(port);
|
|
56
|
-
containerPortsWithProtocol.
|
|
55
|
+
const protocol = (0, port_1.getProtocol)(port).toLowerCase();
|
|
56
|
+
containerPortsWithProtocol.add(`${containerPort}/${protocol}`);
|
|
57
57
|
});
|
|
58
58
|
for (const [internalPortWithProtocol, hostPort] of this.iterator()) {
|
|
59
59
|
const [internalPortStr, protocol] = internalPortWithProtocol.split("/");
|
|
60
60
|
const internalPort = parseInt(internalPortStr, 10);
|
|
61
|
-
if (containerPortsWithProtocol.has(internalPort)
|
|
62
|
-
containerPortsWithProtocol.get(internalPort)?.toLowerCase() === protocol?.toLowerCase()) {
|
|
61
|
+
if (containerPortsWithProtocol.has(`${internalPort}/${protocol?.toLowerCase()}`)) {
|
|
63
62
|
boundPorts.setBinding(internalPortWithProtocol, hostPort);
|
|
64
63
|
}
|
|
65
64
|
}
|
package/build/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "12.0.
|
|
1
|
+
export declare const LIB_VERSION = "12.0.3";
|
package/build/version.js
CHANGED
|
@@ -28,6 +28,9 @@ class LogWaitStrategy extends wait_strategy_1.AbstractWaitStrategy {
|
|
|
28
28
|
}, this.startupTimeoutMs);
|
|
29
29
|
const comparisonFn = (line) => {
|
|
30
30
|
if (this.message instanceof RegExp) {
|
|
31
|
+
if (this.message.global || this.message.sticky) {
|
|
32
|
+
this.message.lastIndex = 0;
|
|
33
|
+
}
|
|
31
34
|
return this.message.test(line);
|
|
32
35
|
}
|
|
33
36
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testcontainers",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.3",
|
|
4
4
|
"author": "Cristian Greco",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"properties-reader": "^3.0.1",
|
|
44
44
|
"ssh-remote-port-forward": "^1.0.4",
|
|
45
45
|
"tar-fs": "^3.1.2",
|
|
46
|
-
"tmp": "^0.2.
|
|
47
|
-
"undici": "^
|
|
46
|
+
"tmp": "^0.2.7",
|
|
47
|
+
"undici": "^8.3.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/archiver": "^7.0.0",
|