Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Unify the copy-to-container methods and add reading a file from a container

Aperta
#1,547 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
docker, node.js, typescript
Ambito
api, backend

Direzione di ricerca

Start with the four listed files and trace how copy methods, options, and StartedTestContainer are implemented and forwarded. Review #1522 and coordinate with #1518 before changing the shared copy API. Done means unified before and after start copy methods with matching options and behavior, a way to read one file, and deprecated aliases for existing methods.

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

Descrizione

enhancement minor

What happens

Copying into a container is spread over nine methods with slightly different shapes.

Before start:

  • withCopyFilesToContainer(files[])
  • withCopyDirectoriesToContainer(directories[])
  • withCopyContentToContainer(contents[])
  • withCopyArchivesToContainer(archives[])
  • withCopyToContainerOptions(options)

After start:

  • copyFilesToContainer(files[])
  • copyDirectoriesToContainer(directories[])
  • copyContentToContainer(contents[])
  • copyArchiveToContainer(tar, target?, options?)

The two sides do not behave the same (from reading the code):

  • DirectoryToCopy.mode is applied before start and ignored after start.
  • CopyToContainerOptions applies to every copy before start, but after start only copyArchiveToContainer accepts it.
  • The archive method is plural with an array before start, singular with positional arguments after.

Copying out is limited to copyArchiveFromContainer(path), which resolves to a tar stream. Reading one file's content means bringing a tar parser.

Expected

  • One withCopyToContainer and one copyToContainer that accept a list of entries, each a host path, inline content or an archive, with target and mode. The same options and behaviour on both sides.
  • A way to read a single file from a container, for example readFile(path): Promise<Buffer> or copyFileFromContainer(path, destination).
  • The existing methods stay as deprecated aliases.

Where

  • packages/testcontainers/src/test-container.ts
  • packages/testcontainers/src/generic-container/generic-container.ts
  • packages/testcontainers/src/generic-container/started-generic-container.ts
  • packages/testcontainers/src/types.ts

Notes

  • Java has withCopyToContainer(Transferable, containerPath) and withCopyFileToContainer(MountableFile, containerPath), plus copyFileFromContainer(containerPath, destinationPath) and a variant that passes the file's InputStream to a function. Go has Files []ContainerFile on the request and CopyFileFromContainer, which returns the file's content.
  • Related: #1526. The mode field should say it is an octal permission.

Dependencies

  • Stack on #1522: the reuse hash has to cover copied files. Changing how copies are stored first would move that target.
  • Coordinate with #1518: for the old method names.
  • Changes StartedTestContainer, which today means the interface, StartedGenericContainer and the forwarder on AbstractStartedContainer. Several other issues do the same. The edits do not overlap, so they can go in parallel.
Lingua principale
TypeScript
Stelle
2.6k
Fork
274
Merge medio
1g 14h
PR unite (30g)
44

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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.

Altre issue di testcontainers/testcontainers-node

Tutte le issue di testcontainers/testcontainers-node

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.