Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GithubActionsOverride = func(cfg *Config) { if os.Getenv("COVERALLS_TOKEN") != "" { cfg.Host = "db" cfg.ProjectPath = "/app" cfg.Port = 5432 } }
TODO Find a better way of finding out if this is being executed inside a GitHub Action. GithubActionsOverride is function for database options Config override when using GH Actions.
Functions ¶
func Initialize ¶
func Initialize(cfg Config)
Initialize initializes new global builder with passed config.
func NewBuilder ¶ added in v0.3.0
func NewBuilder(cfg Config) *fixturesBuilder
NewBuilder creates a new builder
func RebuildDatabase ¶
func RebuildDatabase()
RebuildDatabase uses builder rebuildDB to drop and recreate test database from template.
Types ¶
type Config ¶
type Config struct {
// Host is the hostname of the test database service.
Host string
// Port is the port of the test database service.
Port int16
// User defined to connect to database.
User string
// Password defined to connect to database.
Password string
// MainDirectory is the main directory of a project - it's needed to cleanup path for finding fixtures file
MainDirectory string
// FixturesPath is path to fixture files for preloading. Default is set to "/testdata/fixtures".
FixturesPath string
// ProjectPath should be fixed path to the project. It's dynamically added when empty.
ProjectPath string
// OverrideFunc overrides created Config options after initialization.
OverrideFunc func(cfg *Config)
// Migrations are migrations to run during initialization.
Migrations []migrate.Migration
}
Config represents database config for test database service.
Click to show internal directories.
Click to hide internal directories.