testdb

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 15 Imported by: 6

Documentation

Overview

Package testdb creates new databases for tests.

Index

Constants

View Source
const (
	// MySQLURIEnv is the name of the ENV variable checked for the test MySQL
	// instance URI to use. The value must have a trailing slash.
	MySQLURIEnv = "TEST_MYSQL_URI"

	// CockroachDBURIEnv is the name of the ENV variable checked for the test CockroachDB
	// instance URI to use. The value must have a trailing slash.
	CockroachDBURIEnv = "TEST_COCKROACHDB_URI"
)

Variables

This section is empty.

Functions

func CockroachDBAvailable added in v1.5.1

func CockroachDBAvailable() bool

CockroachDBAvailable indicates whether the configured CockroachDB database is available.

func MySQLAvailable added in v1.1.0

func MySQLAvailable() bool

MySQLAvailable indicates whether the configured MySQL database is available.

func NewTrillianDB

func NewTrillianDB(ctx context.Context, driver DriverName) (*sql.DB, 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 SetFDLimit added in v1.3.4

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 SkipIfNoCockroachDB added in v1.5.1

func SkipIfNoCockroachDB(t *testing.T)

SkipIfNoCockroachDB is a test helper that skips tests that require a local CockroachDB.

func SkipIfNoMySQL added in v1.1.0

func SkipIfNoMySQL(t *testing.T)

SkipIfNoMySQL is a test helper that skips tests that require a local MySQL.

Types

type DriverName added in v1.5.1

type DriverName string

DriverName is the name of a database driver.

const (
	// DriverMySQL is the identifier for the MySQL storage driver.
	DriverMySQL DriverName = "mysql"
	// DriverCockroachDB is the identifier for the CockroachDB storage driver.
	DriverCockroachDB DriverName = "cockroachdb"
)

Jump to

Keyboard shortcuts

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