Instantiate default resources (#425)

This commit is contained in:
Jeff Mitchell authored and GitHub committed 2020-09-24 03:31:26 -04:00
1 parent 8d8a7358f8
commit 31fe9292b3
18 files changed
+904 -239

No files matched your search

+31 -4
View File
@@ -239,6 +239,18 @@ type TestControllerOpts struct {
// method automatically.
DisableAuthMethodCreation bool
// DisableScopesCreation can be set true to disable creating scopes
// automatically.
DisableScopesCreation bool
// DisableHostResourcesCreation can be set true to disable creating a host
// catalog and related resources automatically.
DisableHostResourcesCreation bool
// DisableTargetCreation can be set true to disable creating a target
// automatically.
DisableTargetCreation bool
// DisableDatabaseCreation can be set true to disable creating a dev
// database
DisableDatabaseCreation bool
@@ -382,10 +394,25 @@ func NewTestController(t *testing.T, opts *TestControllerOpts) *TestController {
if err := tc.b.CreateGlobalKmsKeys(ctx); err != nil {
t.Fatal(err)
}
}
if !opts.DisableAuthMethodCreation {
if err := tc.b.CreateInitialAuthMethod(ctx); err != nil {
t.Fatal(err)
if !opts.DisableAuthMethodCreation {
if err := tc.b.CreateInitialAuthMethod(ctx); err != nil {
t.Fatal(err)
}
if !opts.DisableScopesCreation {
if err := tc.b.CreateInitialScopes(ctx); err != nil {
t.Fatal(err)
}
if !opts.DisableHostResourcesCreation {
if err := tc.b.CreateInitialHostResources(ctx); err != nil {
t.Fatal(err)
}
if !opts.DisableTargetCreation {
if _, err := tc.b.CreateInitialTarget(ctx); err != nil {
t.Fatal(err)
}
}
}
}
}
}
} else if !opts.DisableDatabaseCreation {