testcontainers / testcontainers/testcontainers-java

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

Offen
#3,013 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Java
Sterne
8.7k
Forks
1.9k
Ø Merge
2 T. 17 Std.
Gemergte PRs (30 T.)
9

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, withReuse(true) durch den Pfad zur Container-Wiederverwendung zu verfolgen, und untersuche anschließend, wie der Hash von CreateContainerCmd mit vorhandenen laufenden Containern verglichen wird. Prüfe die verfügbaren Details von InspectContainerResponse und die Stellen für die Protokollierung. Als abgeschlossen gilt die Aufgabe, wenn eine Nichtübereinstimmung bei der Wiederverwendung eine Warnung mit Container-IDs und Hashes ausgibt und, sofern verfügbar, detailliertere Vergleichsinformationen auf DEBUG- oder TRACE-Ebene protokolliert werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
docker, java
Bereich
observability, testing
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
38/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.