Allow not destroying dev databases (#366)

This also shifts some logic around to better prepare for non-dev-mode
workloads, although it does not actually call the KMS creation functions
and initial auth method creation from non-dev commands yet.
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-09-16 10:10:06 -04:00
1 parent c4e2b88022
commit 37e9fed2e3
5 files changed
+124 -50

No files matched your search

+23 -12
View File
@@ -39,18 +39,19 @@ func getOpts(opt ...Option) (*controller.TestControllerOpts, error) {
}
type option struct {
tcOptions *controller.TestControllerOpts
setWithConfigFile bool
setWithConfigText bool
setDisableAuthMethodCreation bool
setDisableDatabaseCreation bool
setDefaultAuthMethodId bool
setDefaultLoginName bool
setDefaultPassword bool
setRootKms bool
setWorkerAuthKms bool
setRecoveryKms bool
setDatabaseUrl bool
tcOptions *controller.TestControllerOpts
setWithConfigFile bool
setWithConfigText bool
setDisableAuthMethodCreation bool
setDisableDatabaseCreation bool
setDisableDatabaseDesctruction bool
setDefaultAuthMethodId bool
setDefaultLoginName bool
setDefaultPassword bool
setRootKms bool
setWorkerAuthKms bool
setRecoveryKms bool
setDatabaseUrl bool
}
type Option func(*option) error
@@ -108,6 +109,16 @@ func DisableDatabaseCreation() Option {
}
}
// DisableDatabaseCreation skips creating a database in docker and allows one to
// be provided through a tcOptions.
func DisableDatabaseDestruction() Option {
return func(c *option) error {
c.setDisableDatabaseDestruction = true
c.tcOptions.DisableDatabaseDestruction = true
return nil
}
}
func WithDefaultAuthMethodId(id string) Option {
return func(c *option) error {
c.setDefaultAuthMethodId = true