Documentation
¶
Index ¶
- func AccountLevel(t *testing.T, steps ...Step)
- func BuildImportStateIdFunc(resourceId, attr string) func(*terraform.State) (string, error)
- func CreateUuid() string
- func DefaultConfigCustomizer(cfg *config.Config) error
- func GetEnvInt64OrSkipTest(t *testing.T, name string) int64
- func GetEnvOrSkipTest(t *testing.T, name string) string
- func GetRunAsAttribute(t *testing.T, ctx context.Context) string
- func IsAws(t *testing.T) bool
- func IsAzure(t *testing.T) bool
- func IsGcp(t *testing.T) bool
- func LoadAccountEnv(t *testing.T)
- func LoadDebugEnvIfRunsFromIDE(t *testing.T, key string)
- func LoadUcacctEnv(t *testing.T)
- func LoadUcwsEnv(t *testing.T)
- func LoadWorkspaceEnv(t *testing.T)
- func PluginFrameworkProviderForTest(pluginFwOptions ...pluginfw.PluginFrameworkOption) provider.Provider
- func ProvidersWithResourceFallbacks(resourceFallbacks []string) (*schema.Provider, provider.Provider)
- func RandomEmail(prefix ...string) string
- func RandomHex(prefix string, randLen int) string
- func RandomName(prefix ...string) string
- func ResourceCheck(name string, ...) resource.TestCheckFunc
- func ResourceCheckWithState(name string, ...) resource.TestCheckFunc
- func SdkV2ProviderForTest(sdkV2Options ...sdkv2.SdkV2ProviderOption) *schema.Provider
- func Skipf(t *testing.T) func(format string, args ...any)
- func UnityAccountLevel(t *testing.T, steps ...Step)
- func UnityWorkspaceLevel(t *testing.T, steps ...Step)
- func WorkspaceLevel(t *testing.T, steps ...Step)
- type Step
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccountLevel ¶ added in v1.52.0
func BuildImportStateIdFunc ¶ added in v1.52.0
BuildImportStateIdFunc constructs a function that returns the id attribute of a target resouce from the terraform state. This is a helper function for conveniently constructing the ImportStateIdFunc field for a test step.
func CreateUuid ¶ added in v1.65.0
func CreateUuid() string
func DefaultConfigCustomizer ¶ added in v1.71.0
DefaultConfigCustomizer modifies the SDK configuration, setting the HTTP timeout to 10 minutes. Most APIs have a default timeout of 1 minute, but some have longer. Extending the HTTP timeout ensures that tests don't fail even if individual requests take longer than 1 minute.
func GetEnvInt64OrSkipTest ¶ added in v1.52.0
func GetEnvOrSkipTest ¶ added in v1.52.0
GetEnvOrSkipTest proceeds with test only with that env variable
func GetRunAsAttribute ¶ added in v1.65.0
func LoadAccountEnv ¶ added in v1.61.0
func LoadDebugEnvIfRunsFromIDE ¶ added in v1.65.0
loads debug environment from ~/.databricks/debug-env.json
func LoadUcacctEnv ¶ added in v1.61.0
func LoadUcwsEnv ¶ added in v1.61.0
func LoadWorkspaceEnv ¶ added in v1.61.0
func PluginFrameworkProviderForTest ¶ added in v1.71.0
func PluginFrameworkProviderForTest(pluginFwOptions ...pluginfw.PluginFrameworkOption) provider.Provider
PluginFrameworkProviderForTest creates a test provider with the default config customizer.
func ProvidersWithResourceFallbacks ¶ added in v1.71.0
func ProvidersWithResourceFallbacks(resourceFallbacks []string) (*schema.Provider, provider.Provider)
ProvidersWithResourceFallbacks creates test providers, falling back to the SDKv2 provider for the specified resources. This is a convenience constructor that ensures that the resulting mux'ed provider uses the SDKv2 implementation for the specified resources.
func RandomEmail ¶ added in v1.52.0
RandomEmail generates random email
func RandomName ¶ added in v1.52.0
RandomName gives random name with optional prefix. e.g. qa.RandomName("tf-")
func ResourceCheck ¶
func ResourceCheck(name string, cb func(ctx context.Context, client *common.DatabricksClient, id string) error) resource.TestCheckFunc
resourceCheck calls back a function with client and resource id
func ResourceCheckWithState ¶ added in v1.65.0
func ResourceCheckWithState(name string, cb func(ctx context.Context, client *common.DatabricksClient, state *terraform.InstanceState) error) resource.TestCheckFunc
resourceCheckWithState calls back a function with client and resource instance state
func SdkV2ProviderForTest ¶ added in v1.71.0
func SdkV2ProviderForTest(sdkV2Options ...sdkv2.SdkV2ProviderOption) *schema.Provider
SdkV2ProviderForTest creates a test provider with the default config customizer.
func UnityAccountLevel ¶ added in v1.52.0
func UnityWorkspaceLevel ¶ added in v1.52.0
func WorkspaceLevel ¶ added in v1.52.0
Types ¶
type Step ¶
type Step struct {
// Terraform HCL for resources to materialize in this test step.
Template string
// This function is called after the template is applied. Useful for making assertions
// or doing cleanup.
Check func(*terraform.State) error
// Setup function called before the template is materialized.
PreConfig func()
Destroy bool
Taint []string
ExpectNonEmptyPlan bool
ExpectError *regexp.Regexp
ConfigPlanChecks resource.ConfigPlanChecks
PlanOnly bool
PreventDiskCleanup bool
PreventPostDestroyRefresh bool
// If true, will test the functionality of ImportState by importing the resource with ResourceName (must be set) and the ID of that resource.
// ID can be supplied with either ImportStateId or ImportStateIdFunc.
ImportState bool
ImportStateId string
ImportStateIdFunc func(*terraform.State) (string, error)
ImportStateVerify bool
ImportStateVerifyIdentifierAttribute string
ResourceName string
ProtoV6ProviderFactories map[string]func() (tfprotov6.ProviderServer, error)
}
A step in a terraform acceptance test