|
|
|
|
@ -29,6 +29,7 @@ type option struct {
|
|
|
|
|
setWithConfigText bool
|
|
|
|
|
setDisableDatabaseCreation bool
|
|
|
|
|
setDefaultOrgId bool
|
|
|
|
|
setDatabaseURL bool
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Option func(*option) error
|
|
|
|
|
@ -89,6 +90,18 @@ func WithDefaultOrgId(id string) Option {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// WithDatabaseURL sets the database URL if running externally
|
|
|
|
|
func WithDatabaseURL(url string) Option {
|
|
|
|
|
return func(c *option) error {
|
|
|
|
|
if c.setDatabaseURL {
|
|
|
|
|
return fmt.Errorf("WithDatabaseURL provided more than once.")
|
|
|
|
|
}
|
|
|
|
|
c.setDatabaseURL = true
|
|
|
|
|
c.tcOptions.DatabaseURL = url
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NewTestController blocks until a new TestController is created, returns the url for the TestController and a function
|
|
|
|
|
// that can be called to tear down the controller after it has been used for testing.
|
|
|
|
|
func NewTestController(t *testing.T, opt ...Option) *TestController {
|
|
|
|
|
|