Documentation
¶
Overview ¶
Package pg starts the throwaway Postgres the nova-config functional tests share, the way pkg/nsprint/testutil starts a throwaway Redis: initdb and pg_ctl from the binaries on PATH (or the well-known install directories, or NOVA_PG_BIN), a free loopback port, everything under the test's temporary directory, trust authentication, and the cleanup stops it. The process is private. It is not the fleet store, and this file names no bench address.
A runner without the binaries FAILS the test with one line naming the binary: no evidence is not negative evidence, and a skip here would let a green run be a run that never executed the store.
Index ¶
Constants ¶
const BinEnv = "NOVA_PG_BIN"
BinEnv names a directory holding initdb, pg_ctl and postgres, for a machine whose install is somewhere the search below does not look.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Server ¶
type Server struct {
Dir string
Bin string
Port string
// User is the superuser initdb made; trust authentication, no password.
User string
// contains filtered or unexported fields
}
Server is one running throwaway Postgres.
func Start ¶
Start is the per-test form: a server under t.TempDir(), stopped by the cleanup, its DSN returned. A missing binary fails the test with the line Binaries returns.
func StartServer ¶
StartServer runs initdb and pg_ctl start under dir on a free loopback port. The caller stops it with Stop. It is the TestMain form: one server for a package, one database per test through Database.
func (*Server) DSN ¶
DSN is the connection string of one database on the server, for pgx: a loopback address, trust authentication, no password anywhere.