Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteSQL ¶
ExecuteSQL executes the given SQL migration on the provided sqlx.DB or DataSource. This is a convenience helper for running CREATE TABLE and other DDL statements.
Usage:
db := pgtest.SetupTestDB(t) ds := sqlutil.WrapDataSource(db, logger.Test(t)) err := pgtest.ExecuteSQL(ctx, ds, testdata.CreateLogPollerTables) require.NoError(t, err)
func SetupTestDB ¶
func SetupTestDB(t testing.TB) sqlutil.DataSource
SetupTestDB creates a test database with DataSource wrapper using chainlink-testing-framework's postgres testcontainer.
This function: 1. Starts a PostgreSQL Docker container automatically 2. Creates a fresh database for the test 3. Returns a sqlutil.DataSource (wrapped sqlx.DB) 4. Auto-cleans up container and database after test completion
This does NOT: - Run chainlink migrations - Start chainlink node - Configure blockchains
You must manually create your tables after calling this function.
Usage:
ds := pgtest.SetupTestDB(t) err := pgtest.ApplyMigration(ctx, ds, testdata.CreateLogPollerTables) require.NoError(t, err)
Requirements:
- Docker must be running on the machine
- No environment variables needed
Types ¶
This section is empty.