testcontainers 9.1.1 → 9.1.2
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.
|
@@ -99,7 +99,7 @@ class GenericContainer {
|
|
|
99
99
|
};
|
|
100
100
|
if (this.reuse) {
|
|
101
101
|
const containerHash = (0, hash_1.hash)(JSON.stringify(createContainerOptions));
|
|
102
|
-
createContainerOptions.labels = { [labels_1.LABEL_CONTAINER_HASH]: containerHash };
|
|
102
|
+
createContainerOptions.labels = Object.assign(Object.assign({}, createContainerOptions.labels), { [labels_1.LABEL_CONTAINER_HASH]: containerHash });
|
|
103
103
|
logger_1.log.debug(`Container reuse has been enabled, hash: ${containerHash}`);
|
|
104
104
|
const container = yield (0, get_container_1.getContainerByHash)(containerHash);
|
|
105
105
|
if (container !== undefined) {
|
|
@@ -51,7 +51,7 @@ class HttpWaitStrategy extends wait_strategy_1.AbstractWaitStrategy {
|
|
|
51
51
|
}
|
|
52
52
|
withBasicCredentials(username, password) {
|
|
53
53
|
const base64Encoded = Buffer.from(`${username}:${password}`).toString("base64");
|
|
54
|
-
this.headers = Object.assign(Object.assign({}, this.headers), { Authorization: `
|
|
54
|
+
this.headers = Object.assign(Object.assign({}, this.headers), { Authorization: `Basic ${base64Encoded}` });
|
|
55
55
|
return this;
|
|
56
56
|
}
|
|
57
57
|
withReadTimeout(readTimeout) {
|
|
@@ -40,38 +40,38 @@ class CredentialProvider {
|
|
|
40
40
|
return new Promise((resolve, reject) => {
|
|
41
41
|
(0, child_process_1.exec)(`${providerName} list`, (err, stdout) => {
|
|
42
42
|
if (err) {
|
|
43
|
-
logger_1.log.error(
|
|
44
|
-
return reject(
|
|
43
|
+
logger_1.log.error(`An error occurred listing credentials: ${err}`);
|
|
44
|
+
return reject(new Error("An error occurred listing credentials"));
|
|
45
45
|
}
|
|
46
46
|
try {
|
|
47
47
|
const response = JSON.parse(stdout);
|
|
48
|
-
resolve(response);
|
|
48
|
+
return resolve(response);
|
|
49
49
|
}
|
|
50
50
|
catch (e) {
|
|
51
51
|
logger_1.log.error(`Unexpected response from Docker credential provider LIST command: "${stdout}"`);
|
|
52
|
+
return reject(new Error("Unexpected response from Docker credential provider LIST command"));
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
55
|
});
|
|
55
56
|
}
|
|
56
57
|
runCredentialProvider(registry, providerName) {
|
|
57
|
-
return new Promise((resolve) => {
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
58
59
|
const sink = (0, child_process_1.spawn)(providerName, ["get"]);
|
|
59
60
|
const chunks = [];
|
|
60
61
|
sink.stdout.on("data", (chunk) => chunks.push(chunk));
|
|
61
62
|
sink.on("close", (code) => {
|
|
62
|
-
if (code
|
|
63
|
-
logger_1.log.
|
|
64
|
-
|
|
65
|
-
else {
|
|
66
|
-
logger_1.log.warn(`Docker credential provider exited with code: ${code}`);
|
|
63
|
+
if (code !== 0) {
|
|
64
|
+
logger_1.log.error(`An error occurred getting a credential: ${code}`);
|
|
65
|
+
return reject(new Error("An error occurred getting a credential"));
|
|
67
66
|
}
|
|
68
67
|
const response = chunks.join("");
|
|
69
68
|
try {
|
|
70
69
|
const parsedResponse = JSON.parse(response);
|
|
71
|
-
resolve(parsedResponse);
|
|
70
|
+
return resolve(parsedResponse);
|
|
72
71
|
}
|
|
73
72
|
catch (e) {
|
|
74
73
|
logger_1.log.error(`Unexpected response from Docker credential provider GET command: "${response}"`);
|
|
74
|
+
return reject(new Error("Unexpected response from Docker credential provider GET command"));
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
sink.stdin.write(`${registry}\n`);
|