arbiter-test-common-0.1.0.0
arbiter-test-common
Safe HaskellNone
LanguageGHC2024

Arbiter.Test.Setup

Description

Schema setup, teardown, and connection helpers for the arbiter test suites.

Synopsis

Documentation

Source #data SetupConfig

Configuration for test setup

Constructors

SetupConfig 

Fields

Instances

Instances details
Eq SetupConfig Source # 
Instance details

Defined in Arbiter.Test.Setup

Show SetupConfig Source # 
Instance details

Defined in Arbiter.Test.Setup

Source #defaultSetupConfig :: SetupConfig

Default test setup configuration

Source #setupDDL :: Text -> Text -> Connection -> IO ()

Rebuild the schema without notification triggers.

Source #setupDDLWithNotify :: Text -> Text -> Connection -> IO ()

Rebuild the schema with notification triggers.

Source #cleanupData :: Text -> Text -> Connection -> IO ()

Truncate the queue's tables between tests.

Source #execute_ :: Connection -> Text -> IO ()

Run a statement with no parameters (test setup only).

Source #execStatement :: MonadArbiter m => Text -> Params -> m Int64

Run a pre-rendered statement with positional parameters (test setup only).

Source #execQuery :: MonadArbiter m => Text -> Params -> RowCodec a -> m [a]

Run a pre-rendered query with positional parameters and a decoder (test setup only).

Source #setupOnce :: ByteString -> Text -> Text -> Bool -> IO ()

Connect and rebuild the schema once, for a suite's outer bracket.

Source #addQueueTable :: ByteString -> Text -> Text -> Bool -> IO ()

Add one more job-queue table to an existing schema.

Source #disableNoticeReporting :: Connection -> IO ()

Silence libpq notice output for the connection.

Source #createSharedPool :: ByteString -> IO (Pool Connection)

A single-stripe pool of 5 connections for tests.

Source #truncateToMicros :: UTCTime -> UTCTime

Truncate to microsecond precision to match PostgreSQL timestamptz.

Source #seedConcurrencyPoolSQL :: Text -> Text -> Int32 -> [Text]

Seed a concurrency pool's default limit and clear any override, as SQL statements.

Source #drainWith :: IO [a] -> IO [a]

Repeat a batch action until it returns empty, accumulating the results.