Documentation
¶
Index ¶
- func AssertErrors(t *testing.T, err error, assertList []AssertExpression)
- func AssertOutputs(t *testing.T, terraformOptions *terraform.Options, ...)
- func DeployInfraCheckOutputs(t *testing.T, terraformOptions *terraform.Options, ...) *terraform.Options
- func DeployInfraCheckOutputsVerifyChanges(t *testing.T, terraformOptions *terraform.Options, ...) *terraform.Options
- func DeployInfraCheckOutputsVerifyChangesDeployChanges(t *testing.T, terraformOptions *terraform.Options, ...) *terraform.Options
- func DeployInfraNoCheckOutputsNoDestroy(t *testing.T, terraformOptions *terraform.Options) *terraform.Options
- func GenericDeployInfraAndVerifyAssertChanges(t *testing.T, terraformOptions *terraform.Options, ...) *terraform.Options
- func PlanInfraCheckErrors(t *testing.T, terraformOptions *terraform.Options, ...) *terraform.Options
- func ValidateCode(t *testing.T, terraformOptions *terraform.Options) *terraform.Options
- type AdditionalChangesAfterDeployment
- type AssertExpression
- type AssertOperation
- type ChangedResource
- type CheckFunction
- type TerraformVarsInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertErrors ¶
func AssertErrors(t *testing.T, err error, assertList []AssertExpression)
Function is comparing every provided error in expressions lists and checks value using expression defined in the list
func AssertOutputs ¶
func AssertOutputs(t *testing.T, terraformOptions *terraform.Options, assertList []AssertExpression)
Function is comparing every provided output in expressions lists and checks value using expression defined in the list
func DeployInfraCheckOutputs ¶
func DeployInfraCheckOutputs(t *testing.T, terraformOptions *terraform.Options, assertList []AssertExpression) *terraform.Options
Function is responsible for deployment of the infrastructure, verify assert expressions and destroy infrastructure
func DeployInfraCheckOutputsVerifyChanges ¶
func DeployInfraCheckOutputsVerifyChanges(t *testing.T, terraformOptions *terraform.Options, assertList []AssertExpression) *terraform.Options
Function is responsible for deployment of the infrastructure, verify assert expressions, verify if there are no changes in plan after deployment and destroy infrastructure
func DeployInfraCheckOutputsVerifyChangesDeployChanges ¶
func DeployInfraCheckOutputsVerifyChangesDeployChanges(t *testing.T, terraformOptions *terraform.Options, assertList []AssertExpression, additionalChangesAfterDeployment []AdditionalChangesAfterDeployment) *terraform.Options
Function is responsible for deployment of the infrastructure, verify assert expressions, verify if there are no changes in plan after deployment and destroy infrastructure
func DeployInfraNoCheckOutputsNoDestroy ¶
func DeployInfraNoCheckOutputsNoDestroy(t *testing.T, terraformOptions *terraform.Options) *terraform.Options
Function is responsible only for deployment of the infrastructure, no verification of assert expressions and no destroyment of the infrastructure
func GenericDeployInfraAndVerifyAssertChanges ¶
func GenericDeployInfraAndVerifyAssertChanges(t *testing.T, terraformOptions *terraform.Options, assertList []AssertExpression, checkNoChanges bool, additionalChangesAfterDeployment []AdditionalChangesAfterDeployment, destroyInfraAtEnd bool) *terraform.Options
Generic deployment function used in wrapper functions above
- terraformOptions - Terraform options required to execute tests in Terratest
- assertList - list of assert expression
- checkNoChanges - if true, after deployment check if there are no changes planed
- additionalChangesAfterDeployment - if not empty, then it contains list of additional variables values and resources in external file to plan and deploy in order to verify if all expected changes are being provisioned, nothing more or less
- destroyInfraAtEnd - if true, destroy infrastructure at the end of test
func PlanInfraCheckErrors ¶
func PlanInfraCheckErrors(t *testing.T, terraformOptions *terraform.Options, assertList []AssertExpression, noErrorsMessage string) *terraform.Options
Functions is response for planning deployment, verify errors expressions (no changes are deployed)
Types ¶
type AdditionalChangesAfterDeployment ¶
type AdditionalChangesAfterDeployment struct { AdditionalVarsValues map[string]interface{} UseVarFiles []string FileNameWithTfCode string ChangedResources []ChangedResource }
type AssertExpression ¶
type AssertExpression struct { OutputName string Operation AssertOperation ExpectedValue interface{} Message string Check CheckFunction TestedValue string }
Structure used to assert each output value by comparing it to expected value using defined operation.
type AssertOperation ¶
type AssertOperation int64
Enum for operations in assert expressions
const ( NotEmpty AssertOperation = iota Empty Equal NotFound ListLengthEqual StartsWith CheckFunctionWithOutput CheckFunctionWithValue EqualToValue ErrorContains )
type ChangedResource ¶
Structure used to verify if there are changes in resources after adding additional Terraform code or after changing values of some variables
type CheckFunction ¶
Sometimes there is a need to execute custom function to check something, so then in assert expression we need to provide function, which results is compared to true
type TerraformVarsInfo ¶
type TerraformVarsInfo struct { NamePrefix string AzureResourceGroupName string AzureStorageAccountName string GoogleProjectId string GoogleOrgId string }
Structure used for terraform tfvars input information, not all options are used in all public cloud environments
func GenerateTerraformVarsInfo ¶
func GenerateTerraformVarsInfo(cloud string) (TerraformVarsInfo, error)
Function that generates and returns information used by Terraform TFVARS.