testcontainers / testcontainers/testcontainers-python

Feature: other ways to configure than the `.testcontainers.properties` in Home

Abierto
#904 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

🚀 enhancement
Lenguaje dominante
Python
Estrellas
2.3k
Forks
386
Merge medio
4 h 40 min
PR fusionados (30 d)
1

Descripción

What are you trying to do?

I want to run my tests, which rely on Test Containers, on my CI. But I don't have the rights to edit the runner's profile home directory (read-only). So I would like to be able to provide a .testcontainers.properties elsewhere, or from environment variables.

This seems to be possible in the Java version, based on this docstring in the Python version :

Read the .testcontainers.properties for settings. (see the Java implementation for details)
Currently we only support the ~/.testcontainers.properties but may extend to per-project variables later.
:return: the merged properties from the sources.

But (see below) it relies on the Java classpath , and I don't think it would be relevant to use the pythonpath for that on Python's side.
So I am unsure how to proceed towards per-project (or arbitrarily-located) properties files.

But using environment variables should be straightforward.

Why should it be done this way?

Parity with Java implementation, and flexibility.

Other references:

From the Java documentation :

The configuration will be loaded from multiple locations. Properties are considered in the following order:

  1. Environment variables
  2. .testcontainers.properties in user's home folder. Example locations:
  • Linux: /home/myuser/.testcontainers.properties
  • Windows: C:/Users/myuser/.testcontainers.properties
  • macOS: /Users/myuser/.testcontainers.properties
  1. testcontainers.properties on the classpath.
    Note that when using environment variables, configuration property names should be set in upper case with underscore separators, preceded by TESTCONTAINERS_ - e.g. checks.disable becomes TESTCONTAINERS_CHECKS_DISABLE.

Next steps

Does it seem relevant to you ? Would you be interested I contribute a PR for it ?

Guía de contribución

Abrir la guía de contribución

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.

Línea de trabajo

Comienza con testcontainers/core/config.py, especialmente con el comportamiento de carga de la configuración al que se hace referencia en el issue, y compáralo con el orden de configuración de Java en la documentación enlazada. Define cómo deben interactuar las variables de entorno y una ubicación alternativa de las propiedades con la configuración del archivo de inicio. Se considera terminado cuando las fuentes de configuración compatibles y su precedencia estén documentadas y cubiertas por pruebas.

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

Evaluación

Stack tecnológico
python
Área
testing
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.