testcontainers / testcontainers/testcontainers-java

[Enhancement]: Reduce exceptions caused by Unreliables.retryUntilTrue

Offen
#6,833 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

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

Beschreibung

Module

Core

Proposal

Hi 👋

I've been profiling test pipelines in our in-house projects and noticed on several Spring-Boot related projects that use DockerComposeContainer that a large amount of exceptions is thrown when waiting for the containers to start.
image

Throwing RuntimeExceptions with the message "Not ready yet" is not really exceptional here - on the contrary. It's rather the norm. I can't imagine this to be super efficient. It would be great if an alternative solution could be implemented that isn't based on exceptions. Or short-term alternative: throwing a dedicate exception with fillInStackTrace overridden to at least avoid the overhead of generating the stacktrace.

	class NotReadyYetException extends RuntimeException {

		public NotReadyYetException() {
			super("Not ready yet");
		}

		@Override
		public synchronized Throwable fillInStackTrace() {
			return this;
		}

	}

Or caching the exception....

Because duct-tape seems to be read only, I hope this is the correct place for this report. Please lead me to the correct place if not. I'm also open to provide the short term solution somewhere if you want me to and you think this is worthwhile.

Let me know what you think.

Cheers,
Christoph

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, den Einstiegspunkt Unreliables.retryUntilTrue und seine Verwendung durch DockerComposeContainer beim Warten auf Container nachzuverfolgen. Vergleiche das aktuelle ausnahmebasierte Wiederholungsverhalten mit dem vorgeschlagenen Pfad ohne Ausnahmen oder einer stacktrace-freien Ausnahme, und definiere und teste anschließend eine messbare Reduzierung des Ausnahme-Overheads, ohne das Bereitschaftsverhalten zu ändern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
docker, docker-compose, java
Bereich
testing
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

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