acceptance

package
v1.58.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountLevel added in v1.52.0

func AccountLevel(t *testing.T, steps ...Step)

func BuildImportStateIdFunc added in v1.52.0

func BuildImportStateIdFunc(resourceId, attr string) func(*terraform.State) (string, error)

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 GetEnvInt64OrSkipTest added in v1.52.0

func GetEnvInt64OrSkipTest(t *testing.T, name string) int64

func GetEnvOrSkipTest added in v1.52.0

func GetEnvOrSkipTest(t *testing.T, name string) string

GetEnvOrSkipTest proceeds with test only with that env variable

func RandomEmail added in v1.52.0

func RandomEmail(prefix ...string) string

RandomEmail generates random email

func RandomHex added in v1.52.0

func RandomHex(prefix string, randLen int) string

func RandomName added in v1.52.0

func RandomName(prefix ...string) string

RandomName gives random name with optional prefix. e.g. qa.RandomName("tf-")

func UnityAccountLevel added in v1.52.0

func UnityAccountLevel(t *testing.T, steps ...Step)

func UnityWorkspaceLevel added in v1.52.0

func UnityWorkspaceLevel(t *testing.T, steps ...Step)

func WorkspaceLevel added in v1.52.0

func WorkspaceLevel(t *testing.T, steps ...Step)

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
	ExpectNonEmptyPlan        bool
	ExpectError               *regexp.Regexp
	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

Jump to

Keyboard shortcuts

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