Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Add `inspect()` and state accessors to started containers

オープン
#1,545 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
76/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
docker, typescript
領域
backend, testing

調査の方向性

Read the listed StartedTestContainer and StartedGenericContainer files, then trace how InspectResult is received by the start hooks and mapped in map-inspect-result.ts. Check types.ts for the result shape and inspect existing tests around container state. Done when started containers expose a fresh inspect result and the requested state accessors, with exit code represented in InspectResult.

索引モデルが issue の本文から書いたものです。

説明

enhancement minor

What happens

A started container exposes its id, name, labels, hostname and network details, all captured when it started. It has no way to ask about its current state:

  • Is it still running?
  • What was the exit code?
  • What is the health status?
  • What does a fresh inspect say?

InspectResult is an exported type, but only the containerStarting/containerStarted hooks ever receive one. Everyone else has to go through the runtime client and Dockerode:

const client = await getContainerRuntimeClient();
const info = await client.container.inspect(client.container.getById(container.getId()));

That returns Dockerode's ContainerInspectInfo, not the library's InspectResult.

Expected

On StartedTestContainer:

  • inspect(): Promise<InspectResult> for a fresh result
  • convenience accessors built on it, for example isRunning() and getExitCode()

InspectResult gains what those need (exit code).

Where

  • packages/testcontainers/src/test-container.ts
  • packages/testcontainers/src/generic-container/started-generic-container.ts
  • packages/testcontainers/src/utils/map-inspect-result.ts
  • packages/testcontainers/src/types.ts

Notes

  • Java has isRunning(), isHealthy(), getContainerInfo() and getCurrentContainerInfo(). Go has Inspect(ctx), State(ctx) and IsRunning().
  • Useful for one-shot containers (wait for exit, read the exit code) and for assertions in tests that deliberately kill a container.

Dependencies

  • Nothing blocks this. It can start now.
  • Changes StartedTestContainer, which today means the interface, StartedGenericContainer and the forwarder on AbstractStartedContainer. Several other issues do the same. The edits do not overlap, so they can go in parallel.
主要言語
TypeScript
スター
2.6k
フォーク
274
平均マージ
1日 14時間
マージ済み PR(30日)
44

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

testcontainers/testcontainers-node のほかの issue

testcontainers/testcontainers-node の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。