Accept a boolean in the no-argument flag setters

Đang mở
#1,530 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 4 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
52/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, testing

Hướng nghiên cứu

Start with the listed generic container, builder, Docker Compose environment, and test files; compare the six no-argument setters with the existing boolean setters. Check the related work in #1524 and coordinate the shared TestContainer interface edit with #1529. Done means the flag setters accept an optional boolean defaulting to true, existing calls still work, conditional calls can turn flags off, and tests cover the behavior.

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

On/off settings are spelled two ways.

No argument, can only switch on:

  • GenericContainer.withReuse()
  • GenericContainer.withPrivilegedMode()
  • GenericContainer.withDefaultLogDriver()
  • DockerComposeEnvironment.withBuild()
  • DockerComposeEnvironment.withNoRecreate()
  • GenericContainerBuilder.withBuildkit()

Boolean argument:

  • GenericContainer.withAutoCleanup(boolean)
  • GenericContainer.withAutoRemove(boolean)
  • DockerComposeEnvironment.withAutoCleanup(boolean)
  • GenericContainerBuilder.withCache(boolean)

The no-argument form breaks the chain for conditional settings and cannot undo a setting that a subclass or module turned on:

const container = new GenericContainer(image).withExposedPorts(8080);
if (!process.env.CI) {
  container.withReuse();
}

The modules are split the same way: 6 no-argument flag setters and 4 that take a boolean.

Expected

Flag setters accept an optional boolean that defaults to true, so withReuse() keeps working and withReuse(!process.env.CI) becomes possible.

Where

  • packages/testcontainers/src/generic-container/generic-container.ts
  • packages/testcontainers/src/generic-container/generic-container-builder.ts
  • packages/testcontainers/src/docker-compose-environment/docker-compose-environment.ts
  • packages/testcontainers/src/test-container.ts

Notes

  • Java takes a boolean in both withReuse(boolean reusable) and withPrivilegedMode(boolean mode).
  • Worth adding the convention to the add-module skill.

Dependencies

  • Stack on #1524: both change withNoRecreate.
  • Coordinate with #1529: both edit the TestContainer interface.
Ngôn ngữ chính
TypeScript
Star
2.7k
Fork
290
Merge trung bình
4 ngày 1 giờ
Pull request đã merge (30 ngày)
22

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.