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

Provide in-network connection details from modules

Đang mở
#1,567 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
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
docker, node.js, typescript
Lĩnh vực
databases, testing

Hướng nghiên cứu

Start with #1536 for network alias support and coordinate the getter name with #1538. Read the alias code in packages/testcontainers/src/test-container.ts and started-generic-container.ts, then inspect connection getters under packages/modules/*/src and the in-network listener approaches in Kafka and Redpanda. Done means modules can provide a URI using a network alias and internal port, with credentials and database name from module configuration.

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

Module getters return the address as seen from the test process: the Docker host and a mapped port. A second container on the same Docker network needs a different address, the first container's network alias and its internal port, and no module provides it.

const db = await new PostgreSqlContainer(image).withNetwork(network).withNetworkAliases("db").start();

db.getConnectionUri(); // postgres://test:test@localhost:55012/test, no use to another container

const app = await new GenericContainer(appImage)
  .withNetwork(network)
  .withEnvironment({ DATABASE_URL: "postgres://test:test@db:5432/test" }) // assembled by hand
  .start();

The module knows the internal port, the credentials and the database name. The user has to repeat all of them, and keep them in step with the module's defaults.

Expected

Each module can produce its connection details for use inside a network:

db.getConnectionUri({ network }); // postgres://test:test@db:5432/test

A started container can report its aliases on a network, which this needs.

Where

  • packages/testcontainers/src/test-container.ts and started-generic-container.ts, for the aliases
  • the connection getters in packages/modules/*/src

Notes

  • Kafka and Redpanda already have to deal with in-network listeners. Their approach is a starting point.
  • The naming should follow whatever the modules converge on for connection getters.

Dependencies

  • Blocked by #1536: needs a started container to know its aliases on a network.
  • Coordinate with #1538: for the getter name.
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.