Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#1,536 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
57/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
docker, node.js, typescript
Área
api, backend, testing

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
TypeScript
Estrellas
2.6k
Forks
274
Merge medio
1 d 14 h
PR fusionados (30 d)
44

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de testcontainers/testcontainers-node

Todos los issues de testcontainers/testcontainers-node

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.