Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/modules/kafka/src/kafka-container-latest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ describe("KafkaContainer", { timeout: 240_000 }, () => {
// }
});

it("should be listening when started", async () => {
await using container = await new KafkaContainer(IMAGE).start();

const { exitCode } = await container.exec(["bash", "-c", "</dev/tcp/localhost/9093"]);

expect(exitCode).toBe(0);
});

it("should connect with custom network", async () => {
await using network = await new Network().start();
await using container = await new KafkaContainer(IMAGE).withNetwork(network).start();
Expand Down
3 changes: 2 additions & 1 deletion packages/modules/kafka/src/kafka-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ export class KafkaContainer extends GenericContainer {
const boundPorts = BoundPorts.fromInspectResult(client.info.containerRuntime.hostIps, inspectResult).filter(
this.exposedPorts
);
const waitStrategy = await this.selectWaitStrategy(client, dockerInspectResult, this.originalWaitStrategy);
this.waitStrategy = this.originalWaitStrategy;
const waitStrategy = await this.selectWaitStrategy(client, dockerInspectResult);
if (this.startupTimeoutMs !== undefined) {
waitStrategy.withStartupTimeout(this.startupTimeoutMs);
}
Expand Down
3 changes: 2 additions & 1 deletion packages/modules/redpanda/src/redpanda-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export class RedpandaContainer extends GenericContainer {
const boundPorts = BoundPorts.fromInspectResult(client.info.containerRuntime.hostIps, inspectResult).filter(
this.exposedPorts
);
const waitStrategy = await this.selectWaitStrategy(client, dockerInspectResult, this.originalWaitStrategy);
this.waitStrategy = this.originalWaitStrategy;
const waitStrategy = await this.selectWaitStrategy(client, dockerInspectResult);
if (this.startupTimeoutMs !== undefined) {
waitStrategy.withStartupTimeout(this.startupTimeoutMs);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,12 @@ export class GenericContainer implements TestContainer {

protected async selectWaitStrategy(
client: ContainerRuntimeClient,
inspectResult: ContainerInspectInfo,
waitStrategy: WaitStrategy | undefined = this.waitStrategy
inspectResult: ContainerInspectInfo
): Promise<WaitStrategy> {
return selectWaitStrategy({
client,
inspectResult,
waitStrategy,
waitStrategy: this.waitStrategy,
healthCheck: this.healthCheck,
imageNames: [this.imageName.string],
});
Expand Down
Loading