From c4e62697e854ee1ce80d357193c33b87839cbd83 Mon Sep 17 00:00:00 2001 From: Brendan Ryan Date: Tue, 24 Mar 2026 09:23:13 -0700 Subject: [PATCH 1/2] feat: make testcontainer tempo startup timeout configurable Adds a startupTimeout parameter to the testcontainers Tempo instance, backed by a shared containerOptions module for reuse by future container-backed instances. The default timeout remains 10_000ms. --- .changeset/wild-buses-guess.md | 9 +++++++++ src/testcontainers/Instance.ts | 9 +++++++-- src/testcontainers/containerOptions.ts | 20 ++++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 .changeset/wild-buses-guess.md create mode 100644 src/testcontainers/containerOptions.ts diff --git a/.changeset/wild-buses-guess.md b/.changeset/wild-buses-guess.md new file mode 100644 index 0000000..ace166f --- /dev/null +++ b/.changeset/wild-buses-guess.md @@ -0,0 +1,9 @@ +--- +'prool': patch +--- + +Make the testcontainers Tempo instance startup timeout configurable via `startupTimeout`. + +This also introduces a shared internal container-options shape for testcontainers-backed instances, so future container adapters can reuse the same option pattern. + +The default timeout remains `10_000ms`. diff --git a/src/testcontainers/Instance.ts b/src/testcontainers/Instance.ts index 78efd6f..f806942 100644 --- a/src/testcontainers/Instance.ts +++ b/src/testcontainers/Instance.ts @@ -6,6 +6,7 @@ import { } from 'testcontainers' import * as Instance from '../Instance.js' import { command, type tempo as core_tempo } from '../instances/tempo.js' +import * as ContainerOptions from './containerOptions.js' export type { Instance, InstanceOptions } from '../Instance.js' @@ -25,6 +26,7 @@ export const tempo = Instance.define((parameters?: tempo.Parameters) => { containerName = `tempo.${crypto.randomUUID()}`, image = 'ghcr.io/tempoxyz/tempo:latest', log: log_, + startupTimeout, ...args } = parameters || {} @@ -80,7 +82,9 @@ export const tempo = Instance.define((parameters?: tempo.Parameters) => { promise.reject(new Error(`Failed to start: ${error.message}`)) }) }) - .withStartupTimeout(10_000) + .withStartupTimeout( + ContainerOptions.resolveStartupTimeout(startupTimeout), + ) c.start() .then((c) => { @@ -100,7 +104,8 @@ export const tempo = Instance.define((parameters?: tempo.Parameters) => { }) export declare namespace tempo { - export type Parameters = Omit & { + export type Parameters = Omit & + ContainerOptions.Parameters & { /** * Name of the container. */ diff --git a/src/testcontainers/containerOptions.ts b/src/testcontainers/containerOptions.ts new file mode 100644 index 0000000..7a7a41e --- /dev/null +++ b/src/testcontainers/containerOptions.ts @@ -0,0 +1,20 @@ +export const defaults = { + startupTimeout: 10_000, +} as const + +export type Parameters = { + /** + * Startup timeout (in milliseconds) for testcontainers readiness checks. + * + * Increase this when running in CI or environments with slow image pulls. + * + * @default 10_000 + */ + startupTimeout?: number | undefined +} + +export function resolveStartupTimeout( + startupTimeout: number | undefined, +): number { + return startupTimeout ?? defaults.startupTimeout +} From 4f3f9594402b2302c16740e5fbf31c8e3fc1cb64 Mon Sep 17 00:00:00 2001 From: tmm Date: Tue, 24 Mar 2026 12:29:33 -0400 Subject: [PATCH 2/2] Update .changeset/wild-buses-guess.md --- .changeset/wild-buses-guess.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.changeset/wild-buses-guess.md b/.changeset/wild-buses-guess.md index ace166f..a8fae63 100644 --- a/.changeset/wild-buses-guess.md +++ b/.changeset/wild-buses-guess.md @@ -2,8 +2,4 @@ 'prool': patch --- -Make the testcontainers Tempo instance startup timeout configurable via `startupTimeout`. - -This also introduces a shared internal container-options shape for testcontainers-backed instances, so future container adapters can reuse the same option pattern. - -The default timeout remains `10_000ms`. +Made the testcontainers Tempo instance startup timeout configurable via `startupTimeout`. This also introduces a shared internal container-options shape for testcontainers-backed instances, so future container adapters can reuse the same option pattern. The default timeout remains `10_000ms`.