Stress test projection scenario fails on PostgreSQL due to shared database state #371
Labels
No labels
adr
automated
bug
chore
dependencies
documentation
enhancement
epic
github-actions
P1-high
P2-medium
P3-low
release
research
rust
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jwilger/eventcore#371
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The projection stress test scenario reports
Correctness: FAILon the PostgreSQL backend because it shares a database with contract tests and previous stress test runs. Memory and SQLite backends pass because they create fresh in-memory stores per run.Root Cause
The PostgreSQL
eventcore_eventstable accumulates events across all test runs (contract tests, prior stress runs). When the projection scenario runs in batch mode:BankAccountEventevents viaexecute()— these succeedrun_projection()in batch mode (defaultProjectionConfig)event_id(UUID v7, time-ordered){"data": "to be deleted"},{"n": 1}— notBankAccountEventvariantsserde_json::from_value::<BankAccountEvent>()fails for all 1000 rows.ok()inread_eventssilently drops all of them → 0 events returnedapply()is never called →balancesmap is empty → correctness check failsObserved: After a stress test run, the database had 181,130 total events, with 3,237 non-stress-test events (from contract tests) holding the oldest UUID v7 values. The first 1000 rows were 100% contract test events.
Reproduction
Fix
The stress test's postgres setup should isolate itself from other test data. Options:
postgres_stresscreated via docker-compose)DROP TABLE+migrate()at the start of eachrun-allOption 4 is probably the most appropriate for a stress testing tool — start clean each run.
Files
eventcore-stress/src/scenarios/projection.rs— the projection scenarioeventcore-stress/src/main.rs—run-allcommand orchestrationeventcore-postgres/src/lib.rs:267-349—read_eventswith silent.ok()deserialization