acceptance

package
v1.46.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: MPL-2.0 Imports: 23 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 EnsureProvidersAreInitialised

func EnsureProvidersAreInitialised()

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 RandTimeInt

func RandTimeInt() int

func RequiresImportError

func RequiresImportError(resourceName string) *regexp.Regexp

Types

type ClientAuthDetails

type ClientAuthDetails 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
}

type ClientData

type ClientData struct {
	// Default is the Default Credentials being used to connect to Azure
	Default ClientAuthDetails

	// Alternate is an alternate set of Credentials being used to connect to Azure
	Alternate ClientAuthDetails

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

	// SubscriptionIDAlt is the UUID of the Alternate Azure Subscription where tests are being run
	SubscriptionIDAlt 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

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

	// TestResource is a reference to a TestResource which can destroy the resource
	// to enable a Disappears step
	TestResource types.TestResourceVerifyingRemoved
}

type Regions

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

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

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

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

	// MetadataURL is the url of the endpoint where the environment is obtained
	MetadataURL 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) Client

func (td TestData) Client() ClientData

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

func (TestData) DataSourceTest

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

func (TestData) DisappearsStep

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

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

func (td *TestData) RandomIntOfLength(len int) 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

RandomStringOfLength is a random 1 to 1024 character string which is unique to this test case

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 types.TestResource, steps []resource.TestStep)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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