Documentation
¶
Overview ¶
Package testutils provides test helpers for asynqpg integration tests. This package is for testing only and should not be considered stable.
Index ¶
- func ApplyReadyNotifications(t testing.TB, db *sqlx.DB)
- func NotificationPool(t testing.TB, dsn string) *pgxadapter.Pool
- func SetupTestDatabase(t *testing.T) *sqlx.DB
- func SetupTestDatabaseWithConnStr(t *testing.T) (*sqlx.DB, string)
- func SetupTestDatabaseWithImage(t *testing.T, image string) (*sqlx.DB, string)
- type Task
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyReadyNotifications ¶ added in v0.2.0
ApplyReadyNotifications installs LEGACY triggers for upgrade tests only. Normal notification tests and production deployments need no trigger installation.
func NotificationPool ¶ added in v0.2.0
func NotificationPool(t testing.TB, dsn string) *pgxadapter.Pool
NotificationPool connects a test adapter to the fixture database.
func SetupTestDatabase ¶
SetupTestDatabase creates a PostgreSQL test container and returns a connected *sqlx.DB.
func SetupTestDatabaseWithConnStr ¶
SetupTestDatabaseWithConnStr returns both the sqlx.DB and the raw connection string. Useful for tests that need to open additional connections (e.g., via sql.Open or pgx).
Types ¶
type Task ¶
type Task struct {
ID int64 `db:"id"`
Type string `db:"type"`
IdempotencyToken *string `db:"idempotency_token"`
Payload []byte `db:"payload"`
Status string `db:"status"`
Messages pq.StringArray `db:"messages"`
BlockedTill time.Time `db:"blocked_till"`
AttemptsLeft int `db:"attempts_left"`
AttemptsElapsed int `db:"attempts_elapsed"`
}
Task is a simplified representation of an asynqpg task for test assertions.