Documentation ¶
Index ¶
- Variables
- func CheckResourceAttrFunc(name string, key string, test func(string) error) resource.TestCheckFunc
- func CheckResourceAttrIP(name string, key string) resource.TestCheckFunc
- func CheckResourceAttrIPv4(name string, key string) resource.TestCheckFunc
- func CheckResourceAttrIPv6(name string, key string) resource.TestCheckFunc
- func CheckResourceAttrUUID(name string, key string) resource.TestCheckFunc
- func CheckResourceIDChanged(resourceName string, resourceID *string) resource.TestCheckFunc
- func CheckResourceIDPersisted(resourceName string, resourceID *string) resource.TestCheckFunc
- func CheckResourceRawIDMatches(res1, attr1, res2, attr2 string) resource.TestCheckFunc
- func FakeSideProjectProviders(ctx context.Context, tt *TestTools, project *account.Project, ...) map[string]func() (*schema.Provider, error)
- func IsTestResource(identifier string) bool
- func PreCheck(_ *testing.T)
- func Sweep(f func(scwClient *scw.Client) error) error
- func SweepRegions(regions []scw.Region, f func(scwClient *scw.Client, region scw.Region) error) error
- func SweepZones(zones []scw.Zone, f func(scwClient *scw.Client, zone scw.Zone) error) error
- type FakeSideProjectTerminateFunc
- type TestTools
Constants ¶
This section is empty.
Variables ¶
var ( TestDomain = "" TestDomainZone = "" )
var BodyMatcherIgnore = []string{
"organization",
"organization_id",
"project_id",
"project",
}
BodyMatcherIgnore contains the list of json body keys that should be ignored when matching requests with cassettes
var QueryMatcherIgnore = []string{
"organization_id",
}
QueryMatcherIgnore contains the list of query value that should be ignored when matching requests with cassettes
var SensitiveFields = map[string]interface{}{
"secret_key": "00000000-0000-0000-0000-000000000000",
}
SensitiveFields is a map with keys listing fields that should be anonymized value will be set in place of its old value
var UUIDRegex = regexp.MustCompile(`[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}`)
var UpdateCassettes = flag.Bool("cassettes", os.Getenv("TF_UPDATE_CASSETTES") == "true", "Record Cassettes")
UpdateCassettes will update all cassettes of a given test
Functions ¶
func CheckResourceAttrFunc ¶ added in v2.39.0
func CheckResourceAttrIP ¶ added in v2.39.0
func CheckResourceAttrIP(name string, key string) resource.TestCheckFunc
func CheckResourceAttrIPv4 ¶ added in v2.39.0
func CheckResourceAttrIPv4(name string, key string) resource.TestCheckFunc
func CheckResourceAttrIPv6 ¶ added in v2.39.0
func CheckResourceAttrIPv6(name string, key string) resource.TestCheckFunc
func CheckResourceAttrUUID ¶ added in v2.39.0
func CheckResourceAttrUUID(name string, key string) resource.TestCheckFunc
func CheckResourceIDChanged ¶
func CheckResourceIDChanged(resourceName string, resourceID *string) resource.TestCheckFunc
CheckResourceIDChanged checks that the ID of the resource has indeed changed, in case of ForceNew for example. It will fail if resourceID is empty so be sure to use acctest.CheckResourceIDPersisted first in a test suite.
func CheckResourceIDPersisted ¶
func CheckResourceIDPersisted(resourceName string, resourceID *string) resource.TestCheckFunc
CheckResourceIDPersisted checks that the ID of the resource is the same throughout tests of migration or mutation It can be used to check that no ForceNew has been done
func CheckResourceRawIDMatches ¶
func CheckResourceRawIDMatches(res1, attr1, res2, attr2 string) resource.TestCheckFunc
CheckResourceRawIDMatches asserts the equality of IDs from two specified attributes of two Scaleway resources.
func FakeSideProjectProviders ¶ added in v2.39.0
func FakeSideProjectProviders(ctx context.Context, tt *TestTools, project *account.Project, iamAPIKey *iam.APIKey) map[string]func() (*schema.Provider, error)
FakeSideProjectProviders creates a new provider alias "side" with a new Config that will use the given project and API key as default profile configuration.
This is useful to test resources that need to create resources in another project.
func IsTestResource ¶ added in v2.39.0
IsTestResource returns true if given resource identifier is from terraform test identifier should be resource name but some resource don't have names return true if identifier match regex "tf[-_]test" common used prefixes are "tf_tests", "tf_test", "tf-tests", "tf-test"
func SweepRegions ¶ added in v2.39.0
Types ¶
type FakeSideProjectTerminateFunc ¶ added in v2.39.0
type FakeSideProjectTerminateFunc func() error
func CreateFakeIAMManager ¶ added in v2.39.0
func CreateFakeIAMManager(tt *TestTools) (*account.Project, *iam.APIKey, FakeSideProjectTerminateFunc, error)
CreateFakeIAMManager creates a temporary project with a temporary IAM application and policy manager.
The returned function is a cleanup function that should be called when to delete the project.
func CreateFakeSideProject ¶ added in v2.39.0
func CreateFakeSideProject(tt *TestTools) (*account.Project, *iam.APIKey, FakeSideProjectTerminateFunc, error)
CreateFakeSideProject creates a temporary project with a temporary IAM application and policy.
The returned function is a cleanup function that should be called when to delete the project.