testcontainers / testcontainers/testcontainers-java

[Enhancement]: Create volumes for testcontainers

Offen
#7,420 8 Kommentare 2 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

I recently needed to create two test containers that shared data storage. One container would generate data, and the second would read this data. My first thought was to create a docker volume and share the volume in the two containers. This avoids bind mounts which complicates things greatly. Bind mounts are harder to make work cross platform and there are restrictions on bind mounts when I run in my CI tool, bitbucket pipelines.

However, I cannot find any way to do this with testcontainers. There is a way to use withVolumesFrom but there is no way to create the volume as best I can tell. Here is an example of what I was trying to do with test containers but shown with docker commands.

Create a first container with a annonymous volume:
docker run -it --rm --name source --volume=/share ubuntu bash

Create a second container that uses the same volume from the first:
docker run -it --rm --volumes-from source --name dest ubuntu bash

Then in the source container I write a file into the /share directory and I can cat it out in the dest container. I would like to set this up using test containers.

Thanks for this great tool!

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 im Core-Modul, indem du die bestehende Unterstützung für withVolumesFrom und die APIs zur Containerkonfiguration nachverfolgst. Vergleiche sie mit dem in der Aufgabe beschriebenen Verhalten von Dockers volume und --volumes-from. Erledigt ist die Aufgabe, wenn Benutzer ein volume erstellen und es zwischen zwei Testcontainern gemeinsam nutzen können, sodass von einem Container geschriebene Daten vom anderen gelesen werden können.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

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

Neue Issues direkt in Ihr Postfach

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