Documentation ¶
Overview ¶
Package dstester is a collection of tools to make testing Terraform resources created for DeployStack easier.
Index ¶
- Variables
- func Clean(t *testing.T, tf Terraform, resources Resources)
- func DebugCommands(t *testing.T, tf Terraform, resources Resources)
- func TestOperations(t *testing.T, operations Operations, tf Terraform)
- func TestStack(t *testing.T, tf Terraform, resources Resources, ops OperationsSets, ...)
- func TextExistence(t *testing.T, items []Resource)
- func TextNonExistence(t *testing.T, items []Resource)
- type Operation
- type Operations
- type OperationsSets
- type Resource
- type Resources
- type Terraform
- func (tf Terraform) Apply() (string, error)
- func (tf Terraform) Destroy() (string, error)
- func (tf Terraform) DestroyForTest(test *testing.T, debug bool)
- func (tf Terraform) Init() (string, error)
- func (tf Terraform) InitApplyForTest(test *testing.T, debug bool)
- func (tf Terraform) Output(variable string) (string, error)
Constants ¶
This section is empty.
Variables ¶
var ErrorCheckFail = fmt.Errorf("there was an issue with the poll")
ErrorCheckFail is thrown when a check fails
var ErrorURLFail = fmt.Errorf("the url did not return 200 after time allotted")
ErrorURLFail is thrown when a http poll fails
Functions ¶
func Clean ¶
Clean calls the deletion version of all of the gcloud commands to wipe out all of the resources in the project
func DebugCommands ¶
DebugCommands will spit out all of the executables that the framework calls under the covers for debugging purposes
func TestOperations ¶
func TestOperations(t *testing.T, operations Operations, tf Terraform)
TestOperations Cycles through the operations and runs them.
func TextExistence ¶
TextExistence runs through and tests for the existence of each of the GCPResources
func TextNonExistence ¶
TextNonExistence runs through and tests for the lack of existence of each of the GCPResources
Types ¶
type Operation ¶
type Operation struct { Output string Type string Attempts int Interval int Query string Custom string }
Operation represents an intersitial check to be run between terraform apply and terraform destroy
type Operations ¶
Operations are a set of operations to perform and certain times in the lifecycle of a test
func (*Operations) Add ¶
func (os *Operations) Add(o Operation)
Add an operation to the list of operations
type OperationsSets ¶
type OperationsSets map[string]Operations
OperationsSets are the whole collection of all of the pre and post operations
func NewOperationsSet ¶
func NewOperationsSet() OperationsSets
NewOperationsSet returns the default set of operation sets
func (*OperationsSets) Add ¶
func (os *OperationsSets) Add(target string, o Operation)
Add an operation to the underlying set of Operations.
type Resource ¶
type Resource struct { Product string // Portion of the gcloud command between gcloud and describe Name string // The name of the resource to describe Field string // The field to use in format directive. Defaults to 'name' Append string // A string of content to be added to the end of the command string Project string // The GCP project to use for the gcloud command Expected string // The exepcted value that will be checking for. Defaults to vaule of Name Arguments map[string]string // A set of key value pairs that will be added to the end of the gcloud command }
Resource represents a resource in Google Cloud that we want to check to see if it exists. In most cases a gcloud command will be built using this content
type Terraform ¶
type Terraform struct { Dir string // directory containing .tf files Vars map[string]string // collection of vars passed into terraform call }
Terraform is a resource for calling Terraform with a consistent set of variables.
func (Terraform) Apply ¶
Apply runs a terraform apply command passing in the variables to the command
func (Terraform) DestroyForTest ¶
DestroyForTest runs terraform destroy and can output extra information if debug is set to true
func (Terraform) InitApplyForTest ¶
InitApplyForTest runs terraform init and apply and can output extra information if debug is set to true