testcontainers 8.1.1-beta.0 → 8.1.1-beta.4
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.
|
@@ -33,15 +33,14 @@ const getDockerClient = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
33
33
|
const dockerConfig = strategy.getDockerConfig();
|
|
34
34
|
const dockerode = new dockerode_1.default(createDockerodeOptions(dockerConfig));
|
|
35
35
|
logger_1.log.debug(`Testing Docker client strategy URI: ${dockerConfig.uri}`);
|
|
36
|
-
if (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
36
|
+
// if (await isDockerDaemonReachable(dockerode)) {
|
|
37
|
+
const host = yield resolveHost(dockerode, dockerConfig.uri);
|
|
38
|
+
logger_1.log.info(`Using Docker client strategy: ${strategy.getName()}, Docker host: ${host}`);
|
|
39
|
+
log_system_diagnostics_1.logSystemDiagnostics();
|
|
40
|
+
return { host, dockerode };
|
|
41
|
+
// } else {
|
|
42
|
+
// log.warn(`Docker client strategy ${strategy.getName()} is not reachable`);
|
|
43
|
+
// }
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
throw new Error("No Docker client strategy found");
|
|
@@ -52,7 +51,11 @@ const createDockerodeOptions = (dockerConfig) => {
|
|
|
52
51
|
dockerOptions.socketPath = dockerConfig.socketPath;
|
|
53
52
|
}
|
|
54
53
|
else {
|
|
55
|
-
|
|
54
|
+
const { protocol, hostname, port } = new url_1.URL(dockerConfig.uri);
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
// dockerOptions.protocol = protocol.slice(0, -1);
|
|
57
|
+
dockerOptions.host = hostname;
|
|
58
|
+
dockerOptions.port = port;
|
|
56
59
|
}
|
|
57
60
|
if (dockerConfig.ssl) {
|
|
58
61
|
dockerOptions.ca = dockerConfig.ssl.ca;
|
|
@@ -61,16 +64,6 @@ const createDockerodeOptions = (dockerConfig) => {
|
|
|
61
64
|
}
|
|
62
65
|
return dockerOptions;
|
|
63
66
|
};
|
|
64
|
-
const isDockerDaemonReachable = (dockerode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
|
-
try {
|
|
66
|
-
const response = yield dockerode.ping();
|
|
67
|
-
return response.toString() === "OK";
|
|
68
|
-
}
|
|
69
|
-
catch (err) {
|
|
70
|
-
logger_1.log.warn(`Docker daemon is not reachable: ${err}`);
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
67
|
class ConfigurationStrategy {
|
|
75
68
|
getDockerConfig() {
|
|
76
69
|
const { DOCKER_HOST, DOCKER_TLS_VERIFY, DOCKER_CERT_PATH } = process.env;
|
|
@@ -19,7 +19,7 @@ const logSystemDiagnostics = () => __awaiter(void 0, void 0, void 0, function* (
|
|
|
19
19
|
docker: yield get_info_1.getDockerInfo(),
|
|
20
20
|
dockerCompose: yield getDockerComposeInfo(),
|
|
21
21
|
};
|
|
22
|
-
logger_1.log.debug(`System diagnostics: ${JSON.stringify(info
|
|
22
|
+
logger_1.log.debug(`System diagnostics: ${JSON.stringify(info)}`);
|
|
23
23
|
});
|
|
24
24
|
exports.logSystemDiagnostics = logSystemDiagnostics;
|
|
25
25
|
const getNodeInfo = () => {
|