Documentation
¶
Overview ¶
Package pgtest gives a test a pool on a private migrated schema.
Index ¶
Constants ¶
const BinEnv = "MOTTE_TEST_PG_BIN"
BinEnv names a directory that holds initdb and postgres. Without it, Pool looks for both on PATH.
const DSNEnv = "MOTTE_TEST_DATABASE_URL"
DSNEnv is the environment variable that Pool reads when it gets no DSN.
const RequireEnv = "MOTTE_TEST_REQUIRE_PG"
RequireEnv set to 1 makes Pool fail, not skip, when no database is available.
Variables ¶
This section is empty.
Functions ¶
func Pool ¶
Pool creates a fresh schema in the database at dsn, applies the migrations and returns a pool on it. An empty dsn is read from DSNEnv. When that is empty too, Pool starts one throwaway cluster for the package from the binaries of BinEnv or PATH. Without binaries it skips the test, or fails it when RequireEnv is 1. Cleanup drops the schema.
Types ¶
This section is empty.