arbiter-test-0.1.0.0
arbiter-test
Safe HaskellNone
LanguageGHC2024

Arbiter.Test.Concurrency

Description

Concurrency tests for any MonadArbiter backend.

Synopsis

Documentation

concurrencySpec :: (JobPayload payload, KnownSymbol (TableForPayload payload (RegistryOf m)), MonadArbiter m) => (Text -> payload) -> (forall a. env -> m a -> IO a) -> SpecWith envSource #

Arguments

:: (JobPayload payload, KnownSymbol (TableForPayload payload (RegistryOf m)), MonadArbiter m) 
=> (Text -> payload)

Constructor for a simple test message payload

-> (forall a. env -> m a -> IO a)

Runner for monad actions

-> SpecWith env 

Parameterized concurrency test suite. These tests need a connection pool of at least 10 connections. Build the schema with setupOnce and empty it before each test with cleanupData.

raceConditionSpec :: (JobPayload payload, KnownSymbol (TableForPayload payload (RegistryOf m)), MonadArbiter m) => (Text -> payload) -> (forall a. env -> m a -> IO a) -> SpecWith envSource #

Arguments

:: (JobPayload payload, KnownSymbol (TableForPayload payload (RegistryOf m)), MonadArbiter m) 
=> (Text -> payload)

Constructor for a simple test message payload

-> (forall a. env -> m a -> IO a)

Runner for monad actions

-> SpecWith env 

High-contention tests for concurrency defects. Many workers, large job counts, and tight timing windows. Build the schema with setupOnce and empty it before each test with cleanupData.

drainAll :: IO [a] -> (a -> IO ()) -> IO ()Source #

Claim and run jobs until a claim returns none.

findDuplicates :: Ord a => [a] -> [a]Source #

Find duplicate entries in a list. O(n log n).

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.