testdbpgx

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package testdbpgx creates new PostgreSQL databases for tests.

Index

Constants

View Source
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"
)

Variables

This section is empty.

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"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL