unit_testing

package
Version: v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanUpExecution

func CleanUpExecution(t *testing.T, terraformOptions *terraform.Options)

CleanUpExecution ... destroy all resources deployed.

func CreateTerraformOptions

func CreateTerraformOptions(t *testing.T, module *TerraModule) (*terraform.Options, error)

CreateTerraformOptions ... create terraform options using TerraModule fields

Types

type TerraModule

type TerraModule struct {
	RootFolderPath      string
	TerraformModulePath string
	Variables           map[string]interface{}
}

TerraModule is the object to instance terraform modules to testing for

func (*TerraModule) RunStaticAnalysis

func (module *TerraModule) RunStaticAnalysis(t *testing.T, terraformOptions *terraform.Options) (result TerraModuleStatus)

RunStaticAnalysis test just static analysis. Include Parser, dry run: init, validate and plan. Terraform commands wrapped by Terratest Parameters: t - current test state terraformOptions - structure that contains module path and args. Return: result - TerraModuleStatus

func (*TerraModule) TerratestExecution

func (module *TerraModule) TerratestExecution(t *testing.T, useStaticAnalysis bool) (result TerraModuleStatus)

TerratestExecution test only one module isolated. The test stages include: Parser, dry run, init, create or update, provisioning validate and destroy. Terraform commands wrapped by Terratest Parameters: t - current test state useStaticAnalysis - flag to indicate if execution will include static analysis Return: result - TerraModuleStatus

type TerraModuleStatus

type TerraModuleStatus string

TerraModuleStatus enumerates the values for module status validation.

const (
	// Successful .. when TerraModule meet with health check validation
	Successful TerraModuleStatus = "Successful"
	// Failed .. when TerraModule not meet with health check validation
	Failed TerraModuleStatus = "Failed"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto