Documentation ¶
Index ¶
- Constants
- func GetTerraformDir(t *testing.T, path string, isParallel bool) (string, error)
- func SetupTerraformDirForParallelism(t *testing.T, tfDir string) (string, error)
- type Client
- type Config
- type JSONPathTestCases
- type OptFn
- func WithAWS(region string) OptFn
- func WithParallel() OptFn
- func WithRetry(retryableErrors map[string]string, timeBetweenRetries time.Duration, ...) OptFn
- func WithScannedTFVars(workdir, fixturesDir string) OptFn
- func WithVarFiles(workdir string, varFiles ...string) OptFn
- func WithVars(vars map[string]interface{}) OptFn
- type Options
- type Stage
- type StageClient
- func (c *StageClient) ApplyStage(t *testing.T, options *terraform.Options)
- func (c *StageClient) CheckResourcesChanges(t *testing.T, options *terraform.Options, resources []string, ...)
- func (c *StageClient) DestroyStage(t *testing.T, options *terraform.Options)
- func (c *StageClient) PlanAndAssertJSONWithJSONPath(t *testing.T, options *terraform.Options, testCases []JSONPathTestCases)
- func (c *StageClient) PlanStage(t *testing.T, options *terraform.Options)
- func (c *StageClient) PlanStageExpectedNoChanges(t *testing.T, options *terraform.Options)
- func (c *StageClient) PlanStageWithAnySortOfChanges(t *testing.T, options *terraform.Options)
- func (c *StageClient) PlanStageWithDetailedExpectedChanges(t *testing.T, options *terraform.Options, ...)
- func (c *StageClient) PlanStageWithExpectedChanges(t *testing.T, options *terraform.Options, expectedChanges int)
- func (c *StageClient) PlanWithResourcesExpectedToBeCreated(t *testing.T, options *terraform.Options, resources []string)
- func (c *StageClient) PlanWithResourcesExpectedToBeDeleted(t *testing.T, options *terraform.Options, resources []string)
- func (c *StageClient) PlanWithResourcesExpectedToBeUpdated(t *testing.T, options *terraform.Options, resources []string)
- func (c *StageClient) PlanWithSpecificResourcesThatWillChange(t *testing.T, options *terraform.Options, resources []string)
- func (c *StageClient) PlanWithSpecificVariableValueToExpect(t *testing.T, options *terraform.Options, variable, expectedValue string)
- type TestType
Constants ¶
const ( ShouldContain = iota ShouldNOTContain ShouldBeEqual )
const DefaultPlanOutput = "plan.out"
Variables ¶
This section is empty.
Functions ¶
func GetTerraformDir ¶ added in v0.0.6
GetTerraformDir returns the Terraform directory path. It's used to get the Terraform directory path for the scenario. If the scenario is running in parallel, it sets up the Terraform directory for parallelism.
func SetupTerraformDirForParallelism ¶ added in v0.0.6
SetupTerraformDirForParallelism sets up the Terraform directory for parallelism. It copies the Terraform directory to a temporary directory and returns the path to the temporary directory.
Types ¶
type Client ¶
type Client struct { // Stg is the StageClient Stg *StageClient // contains filtered or unexported fields }
func New ¶
New creates a new Terraform options with default retryable errors and saves it to the workdir This is a wrapper around terraform.WithDefaultRetryableErrors
func NewWithOptions ¶
func (*Client) GetAWS ¶
func (c *Client) GetAWS() cloudprovider.AWSAdapter
func (*Client) GetTerraformOptions ¶
type Config ¶
type Config interface { GetTerraformOptions() *terraform.Options GetAWS() cloudprovider.AWSAdapter }
type JSONPathTestCases ¶ added in v0.0.11
type OptFn ¶
func WithParallel ¶ added in v0.0.6
func WithParallel() OptFn
func WithScannedTFVars ¶ added in v0.0.8
func WithVarFiles ¶
type Stage ¶
type Stage interface { DestroyStage(t *testing.T, options *terraform.Options) PlanStage(t *testing.T, options *terraform.Options) ApplyStage(t *testing.T, options *terraform.Options) PlanStageWithExpectedChanges(t *testing.T, options *terraform.Options, expectedChanges int) PlanStageWithDetailedExpectedChanges(t *testing.T, options *terraform.Options, expectedAdds, expectedDeletes, expectedUpdates int) PlanStageWithAnySortOfChanges(t *testing.T, options *terraform.Options) PlanStageExpectedNoChanges(t *testing.T, options *terraform.Options) PlanWithSpecificResourcesThatWillChange(t *testing.T, options *terraform.Options, resources []string) PlanWithResourcesExpectedToBeCreated(t *testing.T, options *terraform.Options, resources []string) PlanWithResourcesExpectedToBeDeleted(t *testing.T, options *terraform.Options, resources []string) PlanWithResourcesExpectedToBeUpdated(t *testing.T, options *terraform.Options, resources []string) PlanWithSpecificVariableValueToExpect(t *testing.T, options *terraform.Options, variable, value string) PlanAndAssertJSONWithJSONPath(t *testing.T, options *terraform.Options, testCases []JSONPathTestCases) }
type StageClient ¶
type StageClient struct{}
func (*StageClient) ApplyStage ¶
func (c *StageClient) ApplyStage(t *testing.T, options *terraform.Options)
func (*StageClient) CheckResourcesChanges ¶
func (c *StageClient) CheckResourcesChanges(t *testing.T, options *terraform.Options, resources []string, check func(tfjson.Actions) bool, failMsg string)
CheckResourcesChanges checks if the specified resources have the expected changes The check function is used to determine if the resource has the expected change
func (*StageClient) DestroyStage ¶
func (c *StageClient) DestroyStage(t *testing.T, options *terraform.Options)
func (*StageClient) PlanAndAssertJSONWithJSONPath ¶ added in v0.0.11
func (c *StageClient) PlanAndAssertJSONWithJSONPath(t *testing.T, options *terraform.Options, testCases []JSONPathTestCases)
PlanAndAssertJSONWithJSONPath performs JSON path planning and assertion in Go testing.
t *testing.T: Testing object options *terraform.Options: Terraform options testCases []JSONPathTestCases: Array of JSON path test cases
func (*StageClient) PlanStage ¶
func (c *StageClient) PlanStage(t *testing.T, options *terraform.Options)
func (*StageClient) PlanStageExpectedNoChanges ¶
func (c *StageClient) PlanStageExpectedNoChanges(t *testing.T, options *terraform.Options)
func (*StageClient) PlanStageWithAnySortOfChanges ¶
func (c *StageClient) PlanStageWithAnySortOfChanges(t *testing.T, options *terraform.Options)