@testcontainers/redpanda 11.13.0 → 12.0.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractStartedContainer, GenericContainer, InspectResult, StartedTestContainer } from "testcontainers";
|
|
2
2
|
export declare class RedpandaContainer extends GenericContainer {
|
|
3
|
-
private
|
|
3
|
+
private originalWaitStrategy;
|
|
4
4
|
constructor(image: string);
|
|
5
5
|
start(): Promise<StartedRedpandaContainer>;
|
|
6
6
|
protected beforeContainerCreated(): Promise<void>;
|
|
@@ -15,7 +15,7 @@ const REST_PROXY_PORT = 8082;
|
|
|
15
15
|
const STARTER_SCRIPT = "/testcontainers_start.sh";
|
|
16
16
|
const WAIT_FOR_SCRIPT_MESSAGE = "Waiting for script...";
|
|
17
17
|
class RedpandaContainer extends testcontainers_1.GenericContainer {
|
|
18
|
-
|
|
18
|
+
originalWaitStrategy;
|
|
19
19
|
constructor(image) {
|
|
20
20
|
super(image);
|
|
21
21
|
this.withExposedPorts(REDPANDA_PORT, REDPANDA_ADMIN_PORT, SCHEMA_REGISTRY_PORT, REST_PROXY_PORT)
|
|
@@ -27,7 +27,7 @@ class RedpandaContainer extends testcontainers_1.GenericContainer {
|
|
|
27
27
|
target: "/etc/redpanda/.bootstrap.yaml",
|
|
28
28
|
},
|
|
29
29
|
]);
|
|
30
|
-
this.
|
|
30
|
+
this.originalWaitStrategy = this.waitStrategy;
|
|
31
31
|
}
|
|
32
32
|
async start() {
|
|
33
33
|
return new StartedRedpandaContainer(await super.start());
|
|
@@ -35,7 +35,7 @@ class RedpandaContainer extends testcontainers_1.GenericContainer {
|
|
|
35
35
|
async beforeContainerCreated() {
|
|
36
36
|
// Change the wait strategy to wait for a log message from a fake starter script
|
|
37
37
|
// so that we can put a real starter script in place at that moment
|
|
38
|
-
this.
|
|
38
|
+
this.originalWaitStrategy = this.waitStrategy;
|
|
39
39
|
this.waitStrategy = testcontainers_1.Wait.forLogMessage(WAIT_FOR_SCRIPT_MESSAGE);
|
|
40
40
|
this.withEntrypoint(["sh"]);
|
|
41
41
|
this.withCommand([
|
|
@@ -54,8 +54,13 @@ class RedpandaContainer extends testcontainers_1.GenericContainer {
|
|
|
54
54
|
]);
|
|
55
55
|
const client = await (0, testcontainers_1.getContainerRuntimeClient)();
|
|
56
56
|
const dockerContainer = client.container.getById(container.getId());
|
|
57
|
+
const dockerInspectResult = await client.container.inspect(dockerContainer);
|
|
57
58
|
const boundPorts = testcontainers_1.BoundPorts.fromInspectResult(client.info.containerRuntime.hostIps, inspectResult).filter(this.exposedPorts);
|
|
58
|
-
await
|
|
59
|
+
const waitStrategy = await this.selectWaitStrategy(client, dockerInspectResult, this.originalWaitStrategy);
|
|
60
|
+
if (this.startupTimeoutMs !== undefined) {
|
|
61
|
+
waitStrategy.withStartupTimeout(this.startupTimeoutMs);
|
|
62
|
+
}
|
|
63
|
+
await (0, testcontainers_1.waitForContainer)(client, dockerContainer, waitStrategy, boundPorts);
|
|
59
64
|
}
|
|
60
65
|
renderRedpandaFile(host, port) {
|
|
61
66
|
const template = (0, handlebars_1.compile)(fs_1.default.readFileSync(path_1.default.join(__dirname, "assets", "redpanda.yaml.hbs"), "utf-8"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testcontainers/redpanda",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"redpanda",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"build": "tsc --project tsconfig.build.json"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"handlebars": "^4.7.
|
|
33
|
-
"testcontainers": "^
|
|
32
|
+
"handlebars": "^4.7.9",
|
|
33
|
+
"testcontainers": "^12.0.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@confluentinc/kafka-javascript": "^1.
|
|
36
|
+
"@confluentinc/kafka-javascript": "^1.9.0"
|
|
37
37
|
}
|
|
38
38
|
}
|