| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Test.Hindsight.Store
Description
Unified test suite API for event store backends
This module provides a single import point for backend test writers. It re-exports all test infrastructure, test suites, and utilities.
Typical Usage
import Test.Hindsight.Store
myStoreRunner :: EventStoreTestRunner MyBackend
myStoreRunner = EventStoreTestRunner { ... }
tests = testGroup "My Backend Tests"
[ testGroup "Generic Tests" (genericEventStoreTests myStoreRunner)
, testGroup "Multi-Instance Tests" (multiInstanceTests myStoreRunner)
, testGroup "Stress Tests" (stressTests myStoreRunner)
, propertyTests myStoreRunner
, testGroup "Ordering Tests" (orderingTests myStoreRunner)
]Synopsis
- data EventStoreTestRunner backend = EventStoreTestRunner {
- withStore :: forall a. (BackendHandle backend -> IO a) -> IO ()
- withStores :: forall a. Int -> ([BackendHandle backend] -> IO a) -> IO ()
- genericEventStoreTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend), Ord (Cursor backend)) => EventStoreTestRunner backend -> [TestTree]
- multiInstanceTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend), Ord (Cursor backend)) => EventStoreTestRunner backend -> [TestTree]
- basicTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend)) => EventStoreTestRunner backend -> [TestTree]
- consistencyTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend), Show (EventStoreError backend)) => EventStoreTestRunner backend -> [TestTree]
- cursorTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend), Ord (Cursor backend)) => EventStoreTestRunner backend -> [TestTree]
- streamVersionTests :: (EventStore backend, StoreConstraints backend IO) => EventStoreTestRunner backend -> [TestTree]
- multiInstanceEventOrderingTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend), Ord (Cursor backend)) => EventStoreTestRunner backend -> [TestTree]
- orderingTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend)) => EventStoreTestRunner backend -> [TestTree]
- propertyTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend)) => EventStoreTestRunner backend -> TestTree
- stressTests :: (EventStore backend, StoreConstraints backend IO) => EventStoreTestRunner backend -> [TestTree]
- module Test.Hindsight.Store.Common
Test Infrastructure
data EventStoreTestRunner backend Source #
Test runner for event store tests
Constructors
| EventStoreTestRunner | |
Fields
| |
Test Suite Composition
genericEventStoreTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend), Ord (Cursor backend)) => EventStoreTestRunner backend -> [TestTree] Source #
Common event store test cases split into focused test groups
multiInstanceTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend), Ord (Cursor backend)) => EventStoreTestRunner backend -> [TestTree] Source #
Multi-instance test cases (for backends that support cross-process subscriptions)
Individual Test Suites
basicTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend)) => EventStoreTestRunner backend -> [TestTree] Source #
Basic test suite for event store backends
consistencyTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend), Show (EventStoreError backend)) => EventStoreTestRunner backend -> [TestTree] Source #
Consistency test suite for event store backends
cursorTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend), Ord (Cursor backend)) => EventStoreTestRunner backend -> [TestTree] Source #
Per-stream cursor test suite for event store backends
streamVersionTests :: (EventStore backend, StoreConstraints backend IO) => EventStoreTestRunner backend -> [TestTree] Source #
Stream version test suite for event store backends
multiInstanceEventOrderingTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend), Ord (Cursor backend)) => EventStoreTestRunner backend -> [TestTree] Source #
Multi-instance ordering test suite for event store backends
orderingTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend)) => EventStoreTestRunner backend -> [TestTree] Source #
Backend-agnostic ordering test suite
propertyTests :: (EventStore backend, StoreConstraints backend IO, Show (Cursor backend)) => EventStoreTestRunner backend -> TestTree Source #
Backend-agnostic property-based tests
stressTests :: (EventStore backend, StoreConstraints backend IO) => EventStoreTestRunner backend -> [TestTree] Source #
Backend-agnostic stress test suite
Test Utilities
module Test.Hindsight.Store.Common