Skip to main content

Module setup

Module setup 

Source
Expand description

Common test setup utilities for Awa integration tests.

Enums§

TestEngine
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 awa schema (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_ENGINE env var: canonical (default) or queue_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 call reset_to_canonical / activate_queue_storage directly.
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 (canonical unless AWA_TEST_ENGINE=queue_storage).
wait_for_counts
Poll queue state counts until a predicate is satisfied, or panic on timeout.