| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Test.StateMachine
Description
Hedgehog state-machine tests for the job engine against any MonadArbiter
backend. A sequential property checks the engine invariants after each step.
A concurrent property runs parallel branches under the HOL detector.
Synopsis
- stateMachineSpec :: ArbiterC sm => (forall a. sm a -> IO a) -> Text -> Text -> (forall a. (Connection -> IO a) -> IO a) -> IO () -> Spec
- type ArbiterC (m :: Type -> Type) = (KnownSymbol (TableForPayload SMPayload (RegistryOf m)), MonadArbiter m, MonadUnliftIO m, RegistryTables (RegistryOf m))
- data SMPayload = SMPayload {}
- installHolDetector :: Connection -> Text -> Text -> IO ()
- holViolations :: Connection -> Text -> Text -> IO [String]
- removeHolDetector :: Connection -> Text -> Text -> IO ()
Documentation
stateMachineSpec :: ArbiterC sm => (forall a. sm a -> IO a) -> Text -> Text -> (forall a. (Connection -> IO a) -> IO a) -> IO () -> SpecSource #
Arguments
| :: ArbiterC sm | |
| => (forall a. sm a -> IO a) | Runner |
| -> Text | |
| -> Text | |
| -> (forall a. (Connection -> IO a) -> IO a) | Raw-connection accessor |
| -> IO () | Reset (truncate) action |
| -> Spec |
Parameterized state-machine property suite. The runner executes a backend
action against the real database. withConn exposes a raw Connection for
the oracle and HOL-detector SQL. reset truncates the test tables.
The runner's registry must declare a queue for SMPayload at the table name.
type ArbiterC (m :: Type -> Type) = (KnownSymbol (TableForPayload SMPayload (RegistryOf m)), MonadArbiter m, MonadUnliftIO m, RegistryTables (RegistryOf m))Source #
Constraints the runner of stateMachineSpec must satisfy.
A payload carrying optional concurrency and rate-limit keys.
Constructors
| SMPayload | |
Instances
installHolDetector :: Connection -> Text -> Text -> IO ()Source #
Install the gap-free HOL violation detector on a raw connection.
holViolations :: Connection -> Text -> Text -> IO [String]Source #
One message per violation the HOL detector trigger recorded.
removeHolDetector :: Connection -> Text -> Text -> IO ()Source #
Remove the HOL detector trigger, function, and violations table.