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

Take network aliases with the network, and allow more than one network

Aperta
#1,536 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à
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
57/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
docker, node.js, typescript
Ambito
api, backend, testing

Direzione di ricerca

Start with withNetwork, withNetworkMode, withNetworkAliases, and startContainer in packages/testcontainers/src/generic-container/generic-container.ts, then read getIpAddress and getNetworkId in packages/testcontainers/src/generic-container/started-generic-container.ts. Trace how network settings reach container startup and how the started-container interface and forwarder expose network details. Done means multiple networks can have aliases, aliases without a network fail at startup, and lookups accept StartedNetwork or a name with a clear error for unattached networks.

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

Descrizione

enhancement minor

What happens

Putting a container on a network with an alias takes two calls that only work together:

new GenericContainer(image).withNetwork(network).withNetworkAliases("db");
  • withNetworkAliases without a network does nothing, silently. The aliases are only applied when a network mode is also set (from reading the code).
  • withNetwork and withNetworkMode write the same field, so the later call wins without a warning.
  • A container can be given one network. There is no way to attach a second.

Reading network details back needs the network's name as a string:

container.getIpAddress(network.getName());

An unknown name throws TypeError: Cannot read properties of undefined from getIpAddress and getNetworkId (from reading the code).

Expected

  • Aliases can be given with the network: withNetwork(network, { aliases: ["db"] }). Calling it again attaches another network.
  • withNetworkAliases without a network throws when the container starts.
  • getIpAddress and getNetworkId accept a StartedNetwork as well as a name, and throw a clear error for a network the container is not on.

Where

  • withNetwork, withNetworkMode, withNetworkAliases and startContainer in packages/testcontainers/src/generic-container/generic-container.ts
  • getIpAddress and getNetworkId in packages/testcontainers/src/generic-container/started-generic-container.ts

Notes

  • Go takes the aliases with the network: network.WithNetwork(aliases, nw), and its request holds a list of networks with aliases per network. Java has the same two separate calls as this library.
  • Related: #1535 (network options).

Dependencies

  • Nothing blocks this. It can start now.
  • 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.