acceptance

package
v1.44.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AzureProvider *schema.Provider
View Source
var SupportedProviders map[string]terraform.ResourceProvider

Functions

func Environment

func Environment() (*azure.Environment, error)

func EnvironmentName

func EnvironmentName() string

func GetAuthConfig

func GetAuthConfig(t *testing.T) *authentication.Config

func PreCheck

func PreCheck(t *testing.T)

func RequiresImportError

func RequiresImportError(resourceName string) *regexp.Regexp

Types

type ClientData added in v1.40.0

type ClientData struct {
	// ClientID is the UUID of the Service Principal being used to connect to Azure
	ClientID string

	// ClientSecret is the Client Secret being used to connect to Azure
	ClientSecret string

	// SubscriptionID is the UUID of the Azure Subscription where tests are being run
	SubscriptionID string

	// TenantID is the UUID of the Azure Tenant where tests are being run
	TenantID string

	// Are we connected as a Service Principal
	// this exists for allowing folks to run the test suite via other
	// credentials in the future; but requires code changes first
	IsServicePrincipal bool
}

type DisappearsStepData added in v1.40.0

type DisappearsStepData struct {
	// Config is a function which returns the Terraform Configuration which should be used for this step
	Config func(data TestData) string

	// CheckExists is a function which confirms that the given Resource in
	// the state exists
	CheckExists func(resourceName string) resource.TestCheckFunc

	// Destroy is a function which looks up the given Resource in the State
	// and then ensures that it's deleted
	Destroy func(resourceName string) resource.TestCheckFunc
}

type Regions added in v1.40.0

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

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

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

Regions is a list of Azure Regions which can be used for test purposes

type TestData added in v1.40.0

type TestData struct {
	// Locations is a set of Azure Regions which should be used for this Test
	Locations Regions

	// RandomString 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

	// Environment is a struct containing Details about the Azure Environment
	// that we're running against
	Environment azure.Environment

	// EnvironmentName is the name of the Azure Environment where we're running
	EnvironmentName string
	// contains filtered or unexported fields
}

func BuildTestData added in v1.40.0

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

BuildTestData generates some test data for the given resource

func (TestData) Client added in v1.40.0

func (td TestData) Client() ClientData

Client returns a struct containing information about the Client being used to connect to Azure

func (TestData) DisappearsStep added in v1.40.0

func (td TestData) DisappearsStep(data DisappearsStepData) resource.TestStep

DisappearsStep returns a Test Step which first confirms the resource exists then destroys it, and expects that the plan at the end of this should show that the resource needs to be created (since it's been destroyed)

func (TestData) ImportStep added in v1.40.0

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) RandomIntOfLength added in v1.42.0

func (td *TestData) RandomIntOfLength(len int) int

func (TestData) RequiresImportErrorStep added in v1.40.0

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

Jump to

Keyboard shortcuts

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