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
5 changes: 5 additions & 0 deletions .changeset/wild-buses-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'prool': patch
---

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`.
9 changes: 7 additions & 2 deletions src/testcontainers/Instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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 || {}

Expand Down Expand Up @@ -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) => {
Expand All @@ -100,7 +104,8 @@ export const tempo = Instance.define((parameters?: tempo.Parameters) => {
})

export declare namespace tempo {
export type Parameters = Omit<core_tempo.Parameters, 'binary'> & {
export type Parameters = Omit<core_tempo.Parameters, 'binary'> &
ContainerOptions.Parameters & {
/**
* Name of the container.
*/
Expand Down
20 changes: 20 additions & 0 deletions src/testcontainers/containerOptions.ts
Original file line number Diff line number Diff line change
@@ -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
}
Loading