Repository navigation
Conversation
…ests The persisters reject saving a step that already exists, and the Redis and Postgres fixtures only closed their connections on teardown, so a second run against the same databases failed 22 tests with duplicate-key errors. - Postgres: the sync and async fixtures delete the rows in their test table. DELETE rather than DROP TABLE, which waits indefinitely behind any connection left idle in a read transaction. - Redis: an autouse fixture deletes only the keys created during each test, so data that already lives in db 0 (Redis' default) is left alone. Fixes apache#1034 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Redis and PostgreSQL persister integration tests left their data behind, so re-running them against the same databases failed 22 tests with duplicate-key errors. Each test now removes what it wrote.
Closes #1034
Changes
test_postgresql.py: the sync and async fixtures delete the rows in their test table on teardown. I usedDELETErather thanDROP TABLEbecauseDROPneeds an exclusive lock and waits indefinitely behind any connection still idle in a read transaction (for example the unpickled persister intest_serialization_with_pickle, until it is garbage collected).DELETEdoesn't conflict with readers.test_b_redis.py: an autouse fixture records the keys in db 0 and db 1 before each test and deletes only the keys that appeared during it. This covers the fixture-based tests andtest_redis_persister_class_backwards_compatible, and leaves any existing data in db 0 (Redis' default db) alone, so there's noFLUSHDB.The persisters themselves are unchanged.
How I tested this
With postgres:15, mongo:7.0 and redis:7 (the CI images):
BURR_CI_INTEGRATION_TESTS=true pytest tests/integrations/persistersthree times in a row against the same databases: 68 passed each time. Before this change: 68 passed on the first run, then 22 failed on every later run.DELETEvsDROP TABLEreasoning: with another connection idle in transaction after aSELECTontesttable,DELETE FROM testtablereturned immediately, whileDROP TABLE testtablewas still waiting after 5 minutes.pre-commit runpasses on the changed files.Notes
git merge-tree). The new Postgres tests in fix: end each psycopg2 persister call's transaction #950 use the same fixture, so they get cleaned up too.Checklist
🤖 Generated with Claude Code