Expand description
Common test setup utilities for Awa integration tests.
Enums§
- Test
Engine - The storage engine the suite is running against, selected by
AWA_TEST_ENGINE.
Functions§
- activate_
queue_ storage - Activate the queue-storage engine against the substrate installed in the
awaschema (mirrors a fresh-install auto-finalize). - clean_
queue - Delete all jobs, queue metadata, and admin caches for a specific queue.
- database_
url - Default database URL for test runs.
- database_
url_ with_ app_ name - Database URL with a custom application_name parameter appended.
- pool
- Create a connection pool.
- pool_
with_ url - Create a connection pool with a custom database URL.
- queue_
state_ counts - Query job state counts for a queue, returning a map of state -> count.
- reset_
runtime_ backend - Initialise the active storage engine to the one selected by the
AWA_TEST_ENGINEenv var:canonical(default) orqueue_storage. awa’s caller-facing contract is engine-invariant, so running the same suite under both values exercises both backends. Tests that pin a specific engine callreset_to_canonical/activate_queue_storagedirectly. - reset_
to_ canonical - Force the canonical engine and clear any queue-storage runtime registration.
- setup
- Create a pool, run migrations, and return it.
- skip_
unless_ canonical - Guard for tests whose assertions are specific to the canonical engine —
e.g. admin-metadata caches maintained by canonical row triggers, or the
canonical running-cancel notification. Returns
true(with a skip notice) when the run is under another engine, so the test can early-return: - state_
count - Extract a count for a given state from a state-counts map.
- test_
engine - The engine selected for this test run (
canonicalunlessAWA_TEST_ENGINE=queue_storage). - wait_
for_ counts - Poll queue state counts until a predicate is satisfied, or panic on timeout.