arbiter-test-0.1.0.0
arbiter-test
Safe HaskellNone
LanguageGHC2024

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

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.

data SMPayloadSource #

A payload carrying optional concurrency and rate-limit keys.

Constructors

SMPayload 

Fields

Instances

Instances details
FromJSON SMPayload Source # 
Instance details

Defined in Arbiter.Test.StateMachine

ToJSON SMPayload Source # 
Instance details

Defined in Arbiter.Test.StateMachine

HasConcurrency SMPayload Source # 
Instance details

Defined in Arbiter.Test.StateMachine

HasRateLimit SMPayload Source # 
Instance details

Defined in Arbiter.Test.StateMachine

Eq SMPayload Source # 
Instance details

Defined in Arbiter.Test.StateMachine

Generic SMPayload Source # 
Instance details

Defined in Arbiter.Test.StateMachine

Associated Types

type Rep SMPayload 
Instance details

Defined in Arbiter.Test.StateMachine

type Rep SMPayload = D1 ('MetaData "SMPayload" "Arbiter.Test.StateMachine" "arbiter-test-0.1.0.0-inplace" 'False) (C1 ('MetaCons "SMPayload" 'PrefixI 'True) (S1 ('MetaSel ('Just "smMessage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "smConcSlot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "smRateKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)))))
Show SMPayload Source # 
Instance details

Defined in Arbiter.Test.StateMachine

type Rep SMPayload Source # 
Instance details

Defined in Arbiter.Test.StateMachine

type Rep SMPayload = D1 ('MetaData "SMPayload" "Arbiter.Test.StateMachine" "arbiter-test-0.1.0.0-inplace" 'False) (C1 ('MetaCons "SMPayload" 'PrefixI 'True) (S1 ('MetaSel ('Just "smMessage") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just "smConcSlot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: S1 ('MetaSel ('Just "smRateKey") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)))))

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.