Redis and Postgres persister integration tests fail when re-run against the same databases
I maintainer di solito rispondono entro 3 giorni
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
Direzione di ricerca
Inizia con i fixture di integrazione Redis e Postgres in tests/integrations/persisters/b_redis.py, b_psycopg2.py e b_asyncpg.py, poi esamina test_redis_persister_class_backwards_compatible, che non ha un fixture. Verifica come i fixture ripuliscono i dati persistiti evitando eliminazioni estese come Redis FLUSHDB. Il lavoro è completato quando tutti i 68 test di integrazione dei persister passano se eseguiti ripetutamente sugli stessi database.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Python
- Stelle
- 2.6k
- Fork
- 218
- Merge medio
- 4g 8h
- PR unite (30g)
- 35
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/burr
-
State.wipe() with no arguments raises TypeError instead of clearing stateForse già presa @alibb007 l’ha presa 2 giorni fa. Apertastatus/needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 3 giorni
-
Notebook UI launcher should use the current Python interpreterForse già presa @sivakumar-mahalingam l’ha presa 21 giorni fa. Apertastatus/needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 3 giorni
-
astep() passes unprocessed inputs to pre_run_step hooksForse già presa @sivakumar-mahalingam l’ha presa 21 giorni fa. Apertastatus/needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 3 giorni
-
`burr` fails to start when the Python path has a space in itForse già presa @enekoreto l’ha presa 24 giorni fa. Apertastatus/needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 3 giorni
-
area/storage area/ui help wanted kind/documentation priority/low
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
apache/burr#524 · 11 commenti ·
I maintainer di solito rispondono entro 3 giorni
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
-
needs-triage tooling
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
neilsh/stunt-reel#317 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
TandoorRecipes/recipes#4926 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
PyTomography/PyTomography#431 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
igormcsouza/tether#278 ·
I maintainer di solito rispondono entro 1 giorno