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

Take network aliases with the network, and allow more than one network

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

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

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

評価

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

調査の方向性

Start with withNetwork, withNetworkMode, withNetworkAliases, and startContainer in packages/testcontainers/src/generic-container/generic-container.ts, then read getIpAddress and getNetworkId in packages/testcontainers/src/generic-container/started-generic-container.ts. Trace how network settings reach container startup and how the started-container interface and forwarder expose network details. Done means multiple networks can have aliases, aliases without a network fail at startup, and lookups accept StartedNetwork or a name with a clear error for unattached networks.

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

説明

enhancement minor

What happens

Putting a container on a network with an alias takes two calls that only work together:

new GenericContainer(image).withNetwork(network).withNetworkAliases("db");
  • withNetworkAliases without a network does nothing, silently. The aliases are only applied when a network mode is also set (from reading the code).
  • withNetwork and withNetworkMode write the same field, so the later call wins without a warning.
  • A container can be given one network. There is no way to attach a second.

Reading network details back needs the network's name as a string:

container.getIpAddress(network.getName());

An unknown name throws TypeError: Cannot read properties of undefined from getIpAddress and getNetworkId (from reading the code).

Expected

  • Aliases can be given with the network: withNetwork(network, { aliases: ["db"] }). Calling it again attaches another network.
  • withNetworkAliases without a network throws when the container starts.
  • getIpAddress and getNetworkId accept a StartedNetwork as well as a name, and throw a clear error for a network the container is not on.

Where

  • withNetwork, withNetworkMode, withNetworkAliases and startContainer in packages/testcontainers/src/generic-container/generic-container.ts
  • getIpAddress and getNetworkId in packages/testcontainers/src/generic-container/started-generic-container.ts

Notes

  • Go takes the aliases with the network: network.WithNetwork(aliases, nw), and its request holds a list of networks with aliases per network. Java has the same two separate calls as this library.
  • Related: #1535 (network options).

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
フォーク
277
平均マージ
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 を短くまとめたダイジェスト。