package testdb
import "github.com/google/trillian/storage/testdb"
Package testdb creates new databases for tests.
Index ¶
- Constants
- func CockroachDBAvailable() bool
- func MySQLAvailable() bool
- func NewTrillianDB(ctx context.Context, driver DriverName) (*sql.DB, func(context.Context), error)
- func SetFDLimit(uLimit uint64) error
- func SkipIfNoCockroachDB(t *testing.T)
- func SkipIfNoMySQL(t *testing.T)
- type DriverName
Constants ¶
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" )
Functions ¶
func CockroachDBAvailable ¶
func CockroachDBAvailable() bool
CockroachDBAvailable indicates whether the configured CockroachDB database is available.
func MySQLAvailable ¶
func MySQLAvailable() bool
MySQLAvailable indicates whether the configured MySQL database is available.
func NewTrillianDB ¶
NewTrillianDB creates an empty database with the Trillian schema. The database name is randomly generated. NewTrillianDB is equivalent to Default().NewTrillianDB(ctx).
func SetFDLimit ¶
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 ¶
SkipIfNoCockroachDB is a test helper that skips tests that require a local CockroachDB.
func SkipIfNoMySQL ¶
SkipIfNoMySQL is a test helper that skips tests that require a local MySQL.
Types ¶
type DriverName ¶
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" )
Source Files ¶
- Version
- v1.7.1 (latest)
- Published
- Jan 9, 2025
- Platform
- linux/amd64
- Imports
- 15 packages
- Last checked
- 5 days ago –
Tools for package owners.