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

Make the port optional in `Wait.forHttp`

Đang mở
#1,534 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ó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
82/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
devtools, testing

Hướng nghiên cứu

Start with packages/testcontainers/src/wait-strategies/wait.ts and packages/testcontainers/src/wait-strategies/http-wait-strategy.ts to trace how Wait.forHttp creates the HTTP wait strategy and how exposed ports are available. Check the existing API and tests for Wait.forHttp, then add coverage for defaulting to the first exposed port, fluent .forPort(8081), and the existing Wait.forHttp(path, port) call. Done means all three forms work.

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

Wait.forHttp(path, port, options) requires the port, even for the usual case of a container with one exposed port:

new GenericContainer(image)
  .withExposedPorts(8080)
  .withWaitStrategy(Wait.forHttp("/health", 8080));

The port is repeated, and in a module it has to be kept in step with the exposed port by hand. Because options is the third positional parameter, it cannot be passed without the port.

Expected

  • The port is optional and defaults to the first exposed port.
  • The port can be set fluently, for example Wait.forHttp("/health").forPort(8081).
  • Wait.forHttp(path, port) keeps working.

Where

  • packages/testcontainers/src/wait-strategies/wait.ts
  • packages/testcontainers/src/wait-strategies/http-wait-strategy.ts

Notes

  • Java's Wait.forHttp(String path) takes only the path, uses the container's first exposed port by default, and has forPort(int) and Wait.forHttps(path).
  • Related: #1507, which is about the options argument (abortOnContainerExit).

Dependencies

  • Nothing blocks this. It can start now.
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.