| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Test.Hindsight.Store.StressTests
Synopsis
- stressTests :: (EventStore backend, StoreConstraints backend IO) => EventStoreTestRunner backend -> [TestTree]
- testMassiveVersionConflicts :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO ()
- testMassiveVersionAdvancement :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO ()
- testVersionSkewScenario :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO ()
- testHighContentionVersionChecks :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO ()
- testVersionExpectationPerformance :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO ()
- testCascadingVersionFailures :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO ()
- testMultiStreamVersionAtomicity :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO ()
- testRapidVersionAdvancement :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO ()
- testVersionCheckWithConnectionFailures :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO ()
- testVersionCheckDeadlock :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO ()
Documentation
stressTests :: (EventStore backend, StoreConstraints backend IO) => EventStoreTestRunner backend -> [TestTree] Source #
Backend-agnostic stress test suite
testMassiveVersionConflicts :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO () Source #
Test extreme version expectation conflicts 100 concurrent writers all try to use the same ExactVersion cursor. Exactly one should succeed, 99 should fail with ConsistencyError.
testMassiveVersionAdvancement :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO () Source #
Test massive version advancement Advance a stream version 1000 times sequentially, then verify: - Very old cursors are rejected - Mid-journey cursors are rejected - Current cursor still works
testVersionSkewScenario :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO () Source #
Test version skew with stale expectations Create a stream, advance it multiple times, then verify: - Stale cursors from several versions ago are rejected - Current cursor works
testHighContentionVersionChecks :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO () Source #
High contention test - 50 concurrent writers to same stream with Any expectation All should succeed since Any doesn't require version checking
testVersionExpectationPerformance :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO () Source #
Test version expectation performance under load Creates 10-20 streams, performs 100 concurrent writes with mixed expectations Verifies reasonable performance (< 5 seconds) and correct success/failure ratios
testCascadingVersionFailures :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO () Source #
Test cascading failures with version dependencies Create a chain A -> B -> C, update A, verify old cursor for A is rejected
testMultiStreamVersionAtomicity :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO () Source #
Test multi-stream atomic operations Create 10 streams, initialize half, try batch with mixed expectations that should fail Verify no partial writes occurred and correct batch succeeds
testRapidVersionAdvancement :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO () Source #
Test rapid version advancement Advance a stream version 100 times rapidly, verify old cursors are invalid
testVersionCheckWithConnectionFailures :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO () Source #
Test version expectations with connection failures Performs 50 operations with random delays that might cause timeouts Verifies at least some successes despite connection issues
testVersionCheckDeadlock :: (EventStore backend, StoreConstraints backend IO) => BackendHandle backend -> IO () Source #
Test version expectation deadlock scenarios Create two streams, start two transactions that lock them in different order Verify both complete within reasonable time (backend should handle deadlocks)