testcontainers / testcontainers/testcontainers-java
Null key for a Map not allowed in JSON (use a converting NullKeySerializer?) on withCreateContainerCmdModifier and withNetwork
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Java
- Estrellas
- 8.7k
- Forks
- 1.9k
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 9
Descripción
I was using GenericContainer below and encounter issue
Caused by: org.testcontainers.shaded.com.fasterxml.jackson.databind.JsonMappingException: Null key for a Map not allowed in JSON (use a converting NullKeySerializer?) (through reference chain: org.testcontainers.shaded.com.github.dockerjava.core.command.CreateContainerCmdImpl["NetworkingConfig"]->org.testcontainers.shaded.com.github.dockerjava.core.command.CreateContainerCmdImpl$NetworkingConfig["EndpointsConfig"])
GenericContainer<?> xContainer = new GenericContainer<>("x:latest")
.withExposedPorts(8080)
.withCreateContainerCmdModifier(cmd -> cmd.withHostConfig(
new HostConfig().withPortBindings(new PortBinding(Ports.Binding.bindPort(8080), new ExposedPort(8081)))
))
.withNetwork(network);
further investigation shows that the error exists only when withCreateContainerCmdModifier and withNetwork are used at the same time. If they are used without the other it works. But I need both of them one for mapping to a new port and the other one for networking capabilities. Please advice. Thanks!
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con los puntos de entrada de GenericContainer withCreateContainerCmdModifier y withNetwork y, después, ejecuta el reproducer usando la combinación mostrada de imagen, asignación de puertos y red. Rastrea la NetworkingConfig generada y confirma que usar ambas opciones ya no produce el error JSON de null-map-key, mientras que cada opción sigue funcionando de forma independiente.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- docker, java
- Área
- devops, testing
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100