testhelp

package
v0.1.0-beta.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2024 License: MPL-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewTestAccCase = func(t *testing.T, testResource *string, preCheck func(*testing.T), steps []resource.TestStep) resource.TestCase {
	t.Helper()

	if preCheck == nil {
		return newTestAccCase(t, testResource, TestAccPreCheck, steps)
	}

	return newTestAccCase(t, testResource, preCheck, steps)
}
View Source
var NewTestUnitCase = func(t *testing.T, testResource *string, fakeServer *fabfake.ServerFactory, preCheck func(*testing.T), steps []resource.TestStep) resource.TestCase {
	t.Helper()

	if preCheck == nil {
		return newTestUnitCase(t, testResource, fakeServer, nil, TestUnitPreCheck, steps)
	}

	return newTestUnitCase(t, testResource, fakeServer, nil, preCheck, steps)
}
View Source
var NewTestUnitCaseWithState = func(t *testing.T, testResource *string, fakeServer *fabfake.ServerFactory, testState *TestState, preCheck func(*testing.T), steps []resource.TestStep) resource.TestCase {
	t.Helper()

	if preCheck == nil {
		return newTestUnitCase(t, testResource, fakeServer, testState, TestUnitPreCheck, steps)
	}

	return newTestUnitCase(t, testResource, fakeServer, testState, preCheck, steps)
}

Functions

func CheckAuthConfig

func CheckAuthConfig(property, value string, testState *TestState) resource.TestCheckFunc

func CheckAuthMethod

func CheckAuthMethod(expected auth.AuthenticationMethod, testState *TestState) resource.TestCheckFunc

func CopyMap

func CopyMap(src map[string]any) map[string]any

Helper function to deep copy a map.

func DataSourceFQN

func DataSourceFQN(providerName, typeName, dataSourceName string) string

Helper function to create a data source FQN.

func DebugPlan

func DebugPlan() plancheck.PlanCheck

func FunctionHeader

func FunctionHeader(providerName, functionName string) string

Helper function to create a function Header.

func GetFixturesDirPath

func GetFixturesDirPath(fixtureDir ...string) string

func GetTestAccProtoV6ProviderFactories

func GetTestAccProtoV6ProviderFactories() map[string]func() (tfprotov6.ProviderServer, error)

getTestAccProtoV6ProviderFactories are used to instantiate a provider during acceptance testing. The factory function will be invoked for every Terraform CLI command executed to create a provider server to which the CLI can reattach.

func GetTestUnitProtoV6ProviderFactories

func GetTestUnitProtoV6ProviderFactories(fabricClientOpts *azcore.ClientOptions, testState *TestState) map[string]func() (tfprotov6.ProviderServer, error)

getTestUnitProtoV6ProviderFactories are used to instantiate a provider during unit testing. The factory function will be invoked for every Terraform CLI command executed to create a provider server to which the CLI can reattach.

func IsWellKnownDataAvailable

func IsWellKnownDataAvailable() bool

func RandomName

func RandomName(length ...int) string

func RandomP12Cert

func RandomP12Cert(password string) []byte

func RandomP12CertB64

func RandomP12CertB64(password string) string

func RandomURI

func RandomURI() string

func RandomUUID

func RandomUUID() string

func RefByFQN

func RefByFQN(objectFQN, path string) string

Helper function to create a reference by FQN.

func ResourceFQN

func ResourceFQN(providerName, typeName, resourceName string) string

Helper function to create a resource FQN.

func ShouldSkipTest

func ShouldSkipTest(t *testing.T) bool

ShouldSkipTest checks if a test should be skipped based on FABRIC_TESTACC_SKIP_NO_SPN environment variable.

func TestAccPreCheck

func TestAccPreCheck(t *testing.T)

lintignore:AT003

func TestAccPreCheckNoEnvs

func TestAccPreCheckNoEnvs(t *testing.T)

lintignore:AT003

func TestAccWorkspaceResource

func TestAccWorkspaceResource(t *testing.T, capacityID string) (resourceHCL, resourceFQN string)

lintignore:AT003

func TestUnitPreCheck

func TestUnitPreCheck(t *testing.T)

func TestUnitPreCheckNoEnvs

func TestUnitPreCheckNoEnvs(t *testing.T)

func TypeName

func TypeName(providerName, typeName string) string

Helper function to create a base type name.

func WellKnown

func WellKnown() map[string]any

Types

type TestState

type TestState struct {
	Config *pconfig.ProviderConfig
}

func NewTestState

func NewTestState() *TestState

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL