testcontainers / testcontainers/testcontainers-java

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

Aperta
#3,013 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Java
Stelle
8.7k
Fork
1.9k
Merge medio
2g 17h
PR unite (30g)
9

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia tracciando withReuse(true) attraverso il percorso di riutilizzo dei container, quindi esamina come l’hash di CreateContainerCmd viene confrontato con i container esistenti in esecuzione. Esamina i dettagli disponibili di InspectContainerResponse e i punti di logging. Il lavoro è completato quando una mancata corrispondenza nel riutilizzo emette un avviso con gli ID dei container e gli hash, con dettagli di confronto più approfonditi a livello DEBUG o TRACE quando disponibili.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
docker, java
Ambito
observability, testing
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
38/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.