Redis and Postgres persister integration tests fail when re-run against the same databases
Los mantenedores suelen responder en 3 días
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
Línea de trabajo
Empieza por los fixtures de integración de Redis y Postgres en tests/integrations/persisters/b_redis.py, b_psycopg2.py y b_asyncpg.py. Después, inspecciona test_redis_persister_class_backwards_compatible, que no tiene fixture. Comprueba cómo limpian los fixtures los datos persistidos y evitan borrados generales como Redis FLUSHDB. El objetivo se alcanza cuando las 68 pruebas de integración de persisters pasan al ejecutarse repetidamente contra las mismas bases de datos.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The Redis and PostgreSQL persister integration tests leave their data behind, so running them a second time against the same databases fails 22 tests. CI doesn't hit this because every job starts fresh service containers, but it breaks the usual local loop of keeping the databases up and re-running the tests.
Current behavior
Against fresh Postgres/MongoDB/Redis instances, tests/integrations/persisters passes (68 passed). Every later run against the same databases fails the same 22 tests: 13 in test_b_redis.py and 9 in test_postgresql.py.
Stack Traces
psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "testtable_pkey"
asyncpg.exceptions.UniqueViolationError: duplicate key value violates unique constraint "testtable_async_pkey"
ValueError: partition_key:app_id:sequence_id[pk:app_id:1] already exists.
Steps to replicate behavior
- Start the same services the CI persister job uses:
docker run -d --rm --name burr-pg -e POSTGRES_PASSWORD=postgres -p 5432:5432 postgres:15 docker run -d --rm --name burr-mongo -p 27017:27017 mongo:7.0 docker run -d --rm --name burr-redis -p 6379:6379 redis:7 BURR_CI_INTEGRATION_TESTS=true pytest tests/integrations/persisters: 68 passed- Run the same command again: 22 failed, 46 passed (and the same on every run after that)
After one clean run, Redis holds 25 keys (15 in db 0, 10 in db 1) and Postgres holds 15 rows (testtable: 8, testtable_async: 7). MongoDB is empty.
Library & System Information
burr main at 36e3ff3 (0.43.0). Python 3.12 on macOS, and Python 3.12 in a linux/arm64 container. postgres:15, mongo:7.0 and redis:7, the same images CI uses.
Expected behavior
The tests clean up after themselves, so they pass on every run, not only the first.
Additional context
The persisters intentionally reject saving a step that already exists: Redis and MongoDB raise ValueError, and Postgres hits the primary key. The tests use fixed keys such as ("pk", "app_id", 1).
- The MongoDB fixture tears down with
persister.collection.drop(), which is why it isn't affected. - The Redis and Postgres fixtures only call
persister.cleanup(), which just closes the connection (b_redis.py,b_psycopg2.py,b_asyncpg.py), so their data stays. test_redis_persister_class_backwards_compatibledoesn't use a fixture and never cleans up either.
A fix shouldn't use FLUSHDB: the Redis tests use db 0, which is Redis' default and may hold a developer's own data. I'll open a PR for this.
- Lenguaje dominante
- Python
- Estrellas
- 2.6k
- Forks
- 218
- Merge medio
- 4 d 8 h
- PR fusionados (30 d)
- 35
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la 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.
Más de apache/burr
-
State.wipe() with no arguments raises TypeError instead of clearing statePosiblemente ocupada @alibb007 la tomó hace 2 días. Abiertostatus/needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 3 días
-
Notebook UI launcher should use the current Python interpreterPosiblemente ocupada @sivakumar-mahalingam la tomó hace 21 días. Abiertostatus/needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 3 días
-
astep() passes unprocessed inputs to pre_run_step hooksPosiblemente ocupada @sivakumar-mahalingam la tomó hace 21 días. Abiertostatus/needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 3 días
-
`burr` fails to start when the Python path has a space in itPosiblemente ocupada @enekoreto la tomó hace 24 días. Abiertostatus/needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 3 días
-
area/storage area/ui help wanted kind/documentation priority/low
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/burr#524 · 11 comentarios ·
Los mantenedores suelen responder en 3 días
Todos los issues de apache/burr
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
-
needs-triage tooling
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
neilsh/stunt-reel#317 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
TandoorRecipes/recipes#4926 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
PyTomography/PyTomography#431 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
igormcsouza/tether#278 ·
Los mantenedores suelen responder en 1 día