Documentation ¶
Index ¶
- func ComposeAggregateTestCheckFunc(fs ...resource.TestCheckFunc) pluginsdk.TestCheckFunc
- func ComposeTestCheckFunc(fs ...resource.TestCheckFunc) pluginsdk.TestCheckFunc
- func Environment() (*azure.Environment, error)
- func EnvironmentName() string
- func GetAuthConfig(t *testing.T) *authentication.Config
- func PreCheck(t *testing.T)
- func RandString(strlen int) string
- func RandStringFromCharSet(strlen int, charSet string) string
- func RandTimeInt() int
- func RequiresImportError(resourceName string) *regexp.Regexp
- func RunTestsInSequence(t *testing.T, tests map[string]map[string]func(t *testing.T))
- func TestCheckNoResourceAttr(name, key string) resource.TestCheckFunc
- func TestCheckOutput(name, value string) pluginsdk.TestCheckFunc
- func TestCheckResourceAttr(name, key, value string) pluginsdk.TestCheckFunc
- func TestCheckResourceAttrPair(nameFirst, keyFirst, nameSecond, keySecond string) resource.TestCheckFunc
- func TestCheckResourceAttrSet(name, key string) pluginsdk.TestCheckFunc
- func TestMatchOutput(name string, r *regexp.Regexp) pluginsdk.TestCheckFunc
- func TestMatchResourceAttr(name, key string, r *regexp.Regexp) pluginsdk.TestCheckFunc
- type ClientAuthDetails
- type ClientCheckFunc
- type ClientData
- type DisappearsStepData
- type InstanceState
- type Regions
- type State
- type StateChangeConf
- type TestCheckFunc
- type TestData
- func (td TestData) ApplyStep(config func(data TestData) string, testResource types.TestResource) resource.TestStep
- func (td TestData) CheckWithClient(check ClientCheckFunc) resource.TestCheckFunc
- func (td TestData) CheckWithClientForResource(check ClientCheckFunc, resourceName string) resource.TestCheckFunc
- func (td TestData) CheckWithClientWithoutResource(check ClientCheckFunc) resource.TestCheckFunc
- func (td TestData) Client() ClientData
- func (td TestData) DataSourceTest(t *testing.T, steps []TestStep)
- func (td TestData) DataSourceTestInSequence(t *testing.T, steps []TestStep)
- func (td TestData) DisappearsStep(data DisappearsStepData) resource.TestStep
- func (td TestData) ImportStep(ignore ...string) resource.TestStep
- func (td TestData) ImportStepFor(resourceName string, ignore ...string) resource.TestStep
- func (td *TestData) RandomIntOfLength(len int) int
- func (td *TestData) RandomStringOfLength(len int) string
- func (td TestData) RequiresImportErrorStep(configBuilder func(data TestData) string) resource.TestStep
- func (td TestData) ResourceSequentialTest(t *testing.T, testResource types.TestResource, steps []TestStep)
- func (td TestData) ResourceSequentialTestSkipCheckDestroyed(t *testing.T, steps []TestStep)
- func (td TestData) ResourceTest(t *testing.T, testResource types.TestResource, steps []TestStep)
- func (td TestData) ResourceTestSkipCheckDestroyed(t *testing.T, steps []TestStep)
- type TestStep
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComposeAggregateTestCheckFunc ¶
func ComposeAggregateTestCheckFunc(fs ...resource.TestCheckFunc) pluginsdk.TestCheckFunc
func ComposeTestCheckFunc ¶
func ComposeTestCheckFunc(fs ...resource.TestCheckFunc) pluginsdk.TestCheckFunc
func Environment ¶
func Environment() (*azure.Environment, error)
func EnvironmentName ¶
func EnvironmentName() string
func GetAuthConfig ¶
func GetAuthConfig(t *testing.T) *authentication.Config
func RandString ¶
RandString generates a random alphanumeric string of the length specified
func RandStringFromCharSet ¶
func RandTimeInt ¶
func RandTimeInt() int
func RequiresImportError ¶
func RunTestsInSequence ¶
func TestCheckNoResourceAttr ¶
func TestCheckNoResourceAttr(name, key string) resource.TestCheckFunc
TestCheckNoResourceAttr is a TestCheckFunc which ensures that NO value exists in state for the given name/key combination.
func TestCheckOutput ¶
func TestCheckOutput(name, value string) pluginsdk.TestCheckFunc
TestCheckOutput is a wrapper to enable builds to continue
func TestCheckResourceAttr ¶
func TestCheckResourceAttr(name, key, value string) pluginsdk.TestCheckFunc
TestCheckResourceAttr is a wrapper to enable builds to continue
func TestCheckResourceAttrPair ¶
func TestCheckResourceAttrPair(nameFirst, keyFirst, nameSecond, keySecond string) resource.TestCheckFunc
TestCheckResourceAttrPair is a TestCheckFunc which validates that the values in state for a pair of name/key combinations are equal.
func TestCheckResourceAttrSet ¶
func TestCheckResourceAttrSet(name, key string) pluginsdk.TestCheckFunc
func TestMatchOutput ¶
func TestMatchOutput(name string, r *regexp.Regexp) pluginsdk.TestCheckFunc
TestMatchOutput is a wrapper to enable builds to continue
func TestMatchResourceAttr ¶
func TestMatchResourceAttr(name, key string, r *regexp.Regexp) pluginsdk.TestCheckFunc
TestMatchResourceAttr is a TestCheckFunc which checks that the value in state for the given name/key combination matches the given regex.
Types ¶
type ClientAuthDetails ¶
type ClientCheckFunc ¶
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 InstanceState ¶
type InstanceState = terraform.InstanceState
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 StateChangeConf ¶
type StateChangeConf = resource.StateChangeConf
type TestCheckFunc ¶
type TestCheckFunc = resource.TestCheckFunc
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 ¶
BuildTestData generates some test data for the given resource
func (TestData) ApplyStep ¶
func (td TestData) ApplyStep(config func(data TestData) string, testResource types.TestResource) resource.TestStep
ApplyStep returns a Test Step which applies a Configuration and then check that the resource exists. This doesn't do any other assertions since it's expected that an ImportStep will be called afterwards to validate that.
func (TestData) CheckWithClient ¶
func (td TestData) CheckWithClient(check ClientCheckFunc) resource.TestCheckFunc
CheckWithClient returns a TestCheckFunc which will call a ClientCheckFunc with the provider context and clients
func (TestData) CheckWithClientForResource ¶
func (td TestData) CheckWithClientForResource(check ClientCheckFunc, resourceName string) resource.TestCheckFunc
CheckWithClientForResource returns a TestCheckFunc which will call a ClientCheckFunc with the provider context and clients for the named resource
func (TestData) CheckWithClientWithoutResource ¶
func (td TestData) CheckWithClientWithoutResource(check ClientCheckFunc) resource.TestCheckFunc
CheckWithClientWithoutResource returns a TestCheckFunc which will call a ClientCheckFunc with the provider context and clients to find if a resource exists when the resource that created it is destroyed.
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) DataSourceTestInSequence ¶
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 ¶
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 ¶
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) RandomIntOfLength ¶
RandomIntOfLength is a random 8 to 18 digit integer which is unique to this test case
func (*TestData) RandomStringOfLength ¶
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