testcontainers / testcontainers/testcontainers-java

Improve logging when withReuse() is specified and a container cannot be reused.

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

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

主要言語
Java
スター
8.7k
フォーク
1.9k
平均マージ
2日 17時間
マージ済み PR(30日)
9

説明

I would like to see a warning logged everytime a container is started withReuse(true) and the hash does not match.

Ideally the warning should contain details of the existing running containers, their container ids and mismatched hashes.

And if possible it would be REALLY helpful to have some details about why the hash didn't match. I realize from reading the code that this isn't possible currently given that the hash is computed from the CreateContainerCmd but maybe some comparisions would be performed of the InspectContainerResponse post container start, as compared to the existing containers.. It would probably make sense to log this level of detail at DEBUG or TRACE levels.

Right now we are facing issues where it's very easy to trigger new containers to be created when the intent was to reuse an existing container, and it's very easy to miss this happening in the logs unless you are paying special attention to it.

And once you've spotted it, it's very hard to troubleshoot why a new container was created vs an existing one being reused.

Sometimes it's some init-data that was updated so the files hash has changed, othertimes, it's something more subtle like a host bind path having a trailing / but otherwise being exactly the same.. This last issue has other implications, which probably warrants it's own ticket, but at the moment it's hard to gather all the evidence easily.. hence this ticket.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

まず、withReuse(true) をコンテナ再利用の経路に沿って追跡し、次に CreateContainerCmd のハッシュが既存の実行中コンテナとどのように比較されるかを調べます。利用可能な InspectContainerResponse の詳細とロギング箇所を確認します。再利用の不一致によってコンテナ ID とハッシュを含む警告が出力され、利用可能な場合は DEBUG または TRACE でより詳細な比較情報が出力されれば完了です。

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

評価

技術スタック
docker, java
領域
observability, testing
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

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

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