| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Arbiter.Test.Setup
Description
Schema setup, teardown, and connection helpers for the arbiter test suites.
Synopsis
- cleanupData :: Text -> Text -> Connection -> IO ()
- cleanupOnce :: ByteString -> Text -> Text -> IO ()
- withConn :: ByteString -> (Connection -> IO a) -> IO a
- terminateBackendsMatching :: ByteString -> Text -> IO ()
- terminatePid :: ByteString -> Int32 -> IO ()
- listenerConnectionCount :: ByteString -> Text -> IO Int
- execute_ :: Connection -> Text -> IO ()
- toQuery :: Text -> Query
- execStatement :: MonadArbiter m => Text -> Params -> m Int64
- execQuery :: MonadArbiter m => Text -> Params -> RowCodec a -> m [a]
- setupOnce :: ByteString -> Text -> Text -> Bool -> IO ()
- addQueueTable :: ByteString -> Text -> Text -> Bool -> IO ()
- createSharedPool :: ByteString -> IO (Pool Connection)
- createPoolOf :: Int -> ByteString -> IO (Pool Connection)
- createPoolWith :: Int -> IO conn -> (conn -> IO ()) -> IO (Pool conn)
- sharedPoolSize :: Int
- concurrencyPoolSize :: Int
- stateMachinePoolSize :: Int
- truncateToMicros :: UTCTime -> UTCTime
- mkTime :: Integer -> Int -> Int -> Int -> Int -> Int -> UTCTime
- seedConcurrencyPolicySQL :: Text -> Text -> Int32 -> [Text]
- drainWith :: IO [a] -> IO [a]
- quietHubLog :: HubLog
Documentation
cleanupData :: Text -> Text -> Connection -> IO ()Source #
Truncate the queue's tables and the schema-wide tables, except rate-limit policies.
cleanupOnce :: ByteString -> Text -> Text -> IO ()Source #
cleanupData on a fresh connection.
withConn :: ByteString -> (Connection -> IO a) -> IO aSource #
Run an action on a fresh connection that is closed afterwards.
terminateBackendsMatching :: ByteString -> Text -> IO ()Source #
Terminate every other backend on this database whose last query matches the LIKE pattern.
terminatePid :: ByteString -> Int32 -> IO ()Source #
Terminate one backend by pid.
listenerConnectionCount :: ByteString -> Text -> IO IntSource #
Count distinct backends whose last query is a LISTEN that names this schema.
execute_ :: Connection -> Text -> IO ()Source #
Run a statement with no parameters (test setup only).
execStatement :: MonadArbiter m => Text -> Params -> m Int64Source #
Run a pre-rendered statement with ? placeholders and positional parameters
(test setup only).
execQuery :: MonadArbiter m => Text -> Params -> RowCodec a -> m [a]Source #
Run a pre-rendered query with ? placeholders, positional parameters and a
decoder (test setup only).
setupOnce :: ByteString -> Text -> Text -> Bool -> IO ()Source #
Arguments
| :: ByteString | |
| -> Text | |
| -> Text | |
| -> Bool | Install the job-arrival notify trigger |
| -> IO () |
Connect and rebuild the schema once, for a suite's outer bracket. It drops the schema with CASCADE and creates it again.
addQueueTable :: ByteString -> Text -> Text -> Bool -> IO ()Source #
Arguments
| :: ByteString | |
| -> Text | |
| -> Text | |
| -> Bool | Install the job-arrival notify trigger |
| -> IO () |
Add one more job-queue table to an existing schema.
createSharedPool :: ByteString -> IO (Pool Connection)Source #
A single-stripe pool of the default size for tests.
createPoolOf :: Int -> ByteString -> IO (Pool Connection)Source #
A single-stripe pool of the given size for tests.
createPoolWith :: Int -> IO conn -> (conn -> IO ()) -> IO (Pool conn)Source #
A single-stripe pool of the given size over any connect and release actions.
The default test pool size.
concurrencyPoolSize :: IntSource #
The pool size for suites that race many claimers.
stateMachinePoolSize :: IntSource #
The pool size for the state-machine suite.
truncateToMicros :: UTCTime -> UTCTimeSource #
Truncate to microsecond precision to match PostgreSQL timestamptz.
mkTime :: Integer -> Int -> Int -> Int -> Int -> Int -> UTCTimeSource #
A UTCTime from calendar and clock components.
seedConcurrencyPolicySQL :: Text -> Text -> Int32 -> [Text]Source #
Seed a concurrency policy's default limit and clear any override, as SQL statements.
drainWith :: IO [a] -> IO [a]Source #
Repeat a batch action until it returns empty, accumulating the results.
A hub logger that swallows warn and error output.