package testdbpgx

import "github.com/google/trillian/storage/postgresql/testdbpgx"

Package testdbpgx creates new PostgreSQL databases for tests.

Index

Constants

const (
	// PostgreSQLURIEnv is the name of the ENV variable checked for the test PostgreSQL
	// instance URI to use. The value must have a trailing slash.
	PostgreSQLURIEnv = "TEST_POSTGRESQL_URI"
)

Functions

func NewTrillianDB

func NewTrillianDB(ctx context.Context, driver DriverName) (*pgxpool.Pool, func(context.Context), error)

NewTrillianDB creates an empty database with the Trillian schema. The database name is randomly generated. NewTrillianDB is equivalent to Default().NewTrillianDB(ctx).

func PostgreSQLAvailable

func PostgreSQLAvailable() bool

PostgreSQLAvailable indicates whether the configured PostgreSQL database is available.

func SetFDLimit

func SetFDLimit(uLimit uint64) error

SetFDLimit sets the soft limit on the maximum number of open file descriptors. See http://man7.org/linux/man-pages/man2/setrlimit.2.html

func SkipIfNoPostgreSQL

func SkipIfNoPostgreSQL(t *testing.T)

SkipIfNoPostgreSQL is a test helper that skips tests that require a local PostgreSQL.

Types

type DriverName

type DriverName string

DriverName is the name of a database driver.

const (
	// DriverPostgreSQL is the identifier for the PostgreSQL storage driver.
	DriverPostgreSQL DriverName = "postgresql"
)

Source Files

testdbpgx.go

Version
v1.7.1 (latest)
Published
Jan 9, 2025
Platform
linux/amd64
Imports
12 packages
Last checked
5 days ago

Tools for package owners.