Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#1,536 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
57/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
docker, node.js, typescript
Lĩnh vực
api, backend, testing

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.
Ngôn ngữ chính
TypeScript
Star
2.6k
Fork
274
Merge trung bình
1 ngày 14 giờ
Pull request đã merge (30 ngày)
44

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của testcontainers/testcontainers-node

Tất cả issue của testcontainers/testcontainers-node

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.