Accept a boolean in the no-argument flag setters

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

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

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

評価

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

調査の方向性

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.

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

説明

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.
主要言語
TypeScript
スター
2.7k
フォーク
290
平均マージ
4日 1時間
マージ済み PR(30日)
22

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

testcontainers/testcontainers-node のほかの issue

testcontainers/testcontainers-node の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。