Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMySQLContainer ¶
NewMySQLContainer starts a named MariaDB container for the given service, applies the given schema files, and returns a *sql.DB connection.
The container is named "osdbe-test-<serviceName>" so it's easy to identify via `docker ps`. The container is cleaned up automatically when the test ends.
func SeedSQL ¶
SeedSQL executes raw SQL statements against the database. Multiple statements can be separated by semicolons.
func SkipIfNoDocker ¶
SkipIfNoDocker skips the test if Docker is not available.
Types ¶
type MySQLContainerResult ¶
type MySQLContainerResult struct {
DB *sql.DB
URL string // oslo.db format, e.g. mysql+pymysql://test:test@host:port/testdb
// contains filtered or unexported fields
}
MySQLContainerResult holds a database connection and oslo.db-format URL returned by NewMySQLContainerWithURL.
func NewMySQLContainerWithURL ¶
func NewMySQLContainerWithURL(t *testing.T, serviceName string, schemaFiles ...string) MySQLContainerResult
NewMySQLContainerWithURL is like NewMySQLContainer but also returns an oslo.db-format connection URL suitable for passing to collector.Config.