Pass the started container to `WaitStrategy.waitUntilReady`
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 45/100
- issue の種類
- リファクタリング
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- docker, node.js, typescript
- 領域
- devtools, testing-qa
調査の方向性
Start with packages/testcontainers/src/wait-strategies/wait-strategy.ts and inspect every strategy in packages/testcontainers/src/wait-strategies/, then trace the listed callers in generic-container.ts, started-generic-container.ts and docker-compose-environment.ts. Check the start() and restart() paths, including how the log strategy receives startTime, and review the coordination issues before changing the shared signatures. Done means strategies receive the started container or a suitable target, callers and custom strategy examples are updated, and the startup deadline and abort signal have a defined place in the interface.
索引モデルが issue の本文から書いたものです。
説明
What happens
A wait strategy is handed the low-level pieces instead of the container:
export interface WaitStrategy {
waitUntilReady(container: Dockerode.Container, boundPorts: BoundPorts, startTime?: Date): Promise<void>;
withStartupTimeout(startupTimeoutMs: number): WaitStrategy;
isStartupTimeoutSet(): boolean;
getStartupTimeout(): number;
}
To do anything useful, an implementation has to fetch the rest itself. The six built-in strategies each call getContainerRuntimeClient() to find the host, read logs or run a command. A custom strategy needs Dockerode knowledge to do what StartedTestContainer already offers as getHost(), getMappedPort(), exec() and logs(). The documented route for custom strategies, StartupCheckStrategy.checkStartupState(dockerClient: Dockerode, containerId: string), has the same shape.
It also makes strategies awkward to reuse on a container that is already started. CouchbaseContainer rebuilds the arguments by hand to run an HTTP wait:
Wait.forHttp("/pools", PORTS.MGMT_PORT)
.forStatusCode(200)
.waitUntilReady(
client.container.getById(startedTestContainer.getId()),
BoundPorts.fromInspectResult(client.info.containerRuntime.hostIps, inspectResult)
);
Kafka and Redpanda do the same through waitForContainer.
Expected
waitUntilReady receives the container, or a narrower target interface that the started container satisfies:
interface WaitStrategy {
waitUntilReady(container: StartedTestContainer): Promise<void>;
}
- A module can write
await Wait.forHttp("/pools", port).waitUntilReady(container). - A custom strategy uses
container.getHost(),container.getMappedPort(port),container.exec(...)andcontainer.logs(). Dockerode.ContainerandBoundPortsleave the public interface.
Where
packages/testcontainers/src/wait-strategies/wait-strategy.ts- every strategy in
packages/testcontainers/src/wait-strategies/ packages/testcontainers/src/wait-strategies/wait-for-container.ts- callers in
generic-container.ts,started-generic-container.tsanddocker-compose-environment.ts
Notes
- Java:
void waitUntilReady(WaitStrategyTarget waitStrategyTarget), whereWaitStrategyTarget extends ContainerStateand the container itself is passed (getHost,getMappedPort,execInContainer,getLogs,getContainerInfo). - Go:
WaitUntilReady(ctx, target StrategyTarget), withHost,Inspect,MappedPort,Logs,Exec,StateandCopyFileFromContainer. - .NET:
IWaitUntil.UntilAsync(IContainer container). - The wait runs before
start()returns, so the started container has to exist before the wait instead of after it.restart()passes astartTimeso the log strategy ignores older output; that needs a home on the target. - Semver: this changes the interface that custom strategies implement, hence
major. - Whatever replaces the current arguments should have room for a startup deadline and an abort signal, so the interface changes once.
Dependencies
- Nothing blocks this. It can start now.
- Coordinate with #1523, #1533, #1534: small changes to the same strategy files. Land them first, since this rewrites every strategy's signature.
- Coordinate with #1532: the same files gain typed errors.
- Coordinate with #1582: the startup deadline needs a place in the new arguments.
- 主要言語
- TypeScript
- スター
- 2.6k
- フォーク
- 274
- 平均マージ
- 1日 14時間
- マージ済み PR(30日)
- 44
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
testcontainers/testcontainers-node のほかの issue
-
enhancement minor
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
testcontainers/testcontainers-node#1539 ·
メンテナーはふだん 1 日以内に返信
-
enhancement minor
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
testcontainers/testcontainers-node#1533 ·
メンテナーはふだん 1 日以内に返信
-
enhancement minor
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
testcontainers/testcontainers-node#1531 ·
メンテナーはふだん 1 日以内に返信
-
enhancement minor
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
testcontainers/testcontainers-node#1529 ·
メンテナーはふだん 1 日以内に返信
-
enhancement minor
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
testcontainers/testcontainers-node#1528 ·
メンテナーはふだん 1 日以内に返信
testcontainers/testcontainers-node の issue をすべて見る
似ている issue
-
enhancement good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
OWASP/cve-lite-cli#1335 ·
メンテナーはふだん 1 日以内に返信
-
Windows: main-screen mouse tracking requires WT_SESSION, so it never enables inside herdr panesオープン
難易度 1/5 1時間未満 初心者へのやさしさ 66/100
code-yeongyu/senpi#3353 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Channels status: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
mastra-ai/mastra#27093 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement needs-triage ui
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
メンテナーはふだん 1 日以内に返信