acceptance

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildTestClient

func BuildTestClient() (*clients.Client, error)

func CheckDestroyedFunc

func CheckDestroyedFunc(client *clients.Client, testResource TestResource, resourceType, resourceName string) func(state *terraform.State) error

CheckDestroyedFunc returns a TestCheckFunc which validates the resource no longer exists

func PreCheck

func PreCheck(t *testing.T)

func RandTimeInt

func RandTimeInt() int

func RequiresImportError

func RequiresImportError(_ string) *regexp.Regexp

Types

type TestData

type TestData struct {
	// LocationPrimary is the Primary Azure Region which should be used for testing
	LocationPrimary string

	// LocationSecondary is the Secondary Azure Region which should be used for testing
	LocationSecondary string

	// LocationTernary is the Ternary Azure Region which should be used for testing
	LocationTernary string

	// RandomInteger is a random integer which is unique to this test case
	RandomInteger int

	// RandomString is a random 5 character string is unique to this test case
	RandomString string

	// ResourceName is the fully qualified resource name, comprising of the
	// resource type and then the resource label
	// e.g. `azurerm_resource_group.test`
	ResourceName string

	// ResourceType is the Terraform Resource Type - `azurerm_resource_group`
	ResourceType string
	// contains filtered or unexported fields
}

func BuildTestData

func BuildTestData(t *testing.T, resourceType string, resourceLabel string) TestData

BuildTestData generates some test data for the given resource

func (TestData) DataSourceTest

func (td TestData) DataSourceTest(t *testing.T, steps []resource.TestStep)

lintignore:AT001

func (TestData) ImportStep

func (td TestData) ImportStep(ignore ...string) resource.TestStep

ImportStep returns a Test Step which Imports the Resource, optionally ignoring any fields which may not be imported (for example, as they're not returned from the API)

func (TestData) ImportStepFor

func (td TestData) ImportStepFor(resourceName string, ignore ...string) resource.TestStep

ImportStepFor returns a Test Step which Imports a given resource by name, optionally ignoring any fields which may not be imported (for example, as they're not returned from the API)

func (TestData) ImportStepWithImportStateIdFunc added in v1.13.1

func (td TestData) ImportStepWithImportStateIdFunc(importStateIdFunc resource.ImportStateIdFunc, ignore ...string) resource.TestStep

ImportStep returns a Test Step which Imports the Resource, optionally ignoring any fields which may not be imported (for example, as they're not returned from the API)

func (*TestData) RandomInt

func (td *TestData) RandomInt() int

RandomIntOfLength is a random 8 to 18 digit integer which is unique to this test case

func (*TestData) RandomStringOfLength

func (td *TestData) RandomStringOfLength(len int) string

func (TestData) RequiresImportErrorStep

func (td TestData) RequiresImportErrorStep(configBuilder func(data TestData) string) resource.TestStep

RequiresImportErrorStep returns a Test Step which expects a Requires Import error to be returned when running this step

func (TestData) ResourceTest

func (td TestData) ResourceTest(t *testing.T, testResource TestResource, steps []resource.TestStep)

func (TestData) UpgradeTest added in v1.13.1

func (td TestData) UpgradeTest(t *testing.T, testResource TestResource, steps []resource.TestStep)

func (TestData) UpgradeTestDeployStep added in v1.13.1

func (td TestData) UpgradeTestDeployStep(step resource.TestStep, upgradeFrom string) resource.TestStep

UpgradeTestDeployStep returns a test step used to deploy the configuration with previous version

func (TestData) UpgradeTestPlanStep added in v1.13.1

func (td TestData) UpgradeTestPlanStep(planStep resource.TestStep) resource.TestStep

UpgradeTestPlanStep returns a test step used to run terraform plan with the development version to check if there's any changes

type TestResource

type TestResource interface {
	Exists(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error)
}

type TestResourceVerifyingRemoved

type TestResourceVerifyingRemoved interface {
	TestResource
	Destroy(ctx context.Context, client *clients.Client, state *terraform.InstanceState) (*bool, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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