testcontainers / testcontainers/testcontainers-java
Option to ignore ports in docker-compose files
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
When using DockerComposeContainer to launch an existing docker-compose file, Testcontainers expose random ports for the services, which can be picked up with the .getServicePort(..., ...) method.
However, if the docker-compose file includes ports definitions, Testcontainers will also expose those fixed ports, defeating the purpose of avoiding collisions by randomizing ports.
I am aware that the documentations states that "it is not necessary to define ports to be exposed in the YAML file; this would inhibit reuse/inclusion of the file in other contexts". But at the same time, DockerComposeContainer is meant to be used in situations where docker-compose files are already in use, and for me, it is convenient that those existing docker-compose files do include the port definitions.
So it would be convenient if Testcontainers could simply ignore the ports in the docker-compose files, and only expose the randomly assigned numbers. As far as I can see, this is not currently an option(?)
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, DockerComposeContainer und die Verarbeitung von getServicePort(...) nachzuverfolgen, um herauszufinden, wo Ports aus einer vorhandenen Compose-Datei verfügbar gemacht werden. Prüfe anschließend die aktuellen Docker-Compose-Integrationstests und definiere completion als eine Option, die feste Ports ignoriert, während sie zufällig zugewiesene Service-Ports beibehält und Kollisionen von Host-Ports vermeidet.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- docker, docker-compose, java
- Bereich
- devops, testing
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100