Documentation ¶
Overview ¶
Package helpers provides helper functions for tests.
Index ¶
- Constants
- Variables
- func CleanupTerraformFolder(t *testing.T, templatesPath string)
- func CleanupTerragruntFolder(t *testing.T, templatesPath string)
- func CopyAndFillMapPlaceholders(t *testing.T, srcPath string, destPath string, placeholders map[string]string)
- func CopyEnvironment(t *testing.T, environmentPath string, includeInCopy ...string) string
- func CopyTerragruntConfigAndFillPlaceholders(t *testing.T, configSrcPath string, configDestPath string, s3BucketName string, ...)
- func CreateEmptyStateFile(t *testing.T, testPath string)
- func CreateTmpTerragruntConfig(t *testing.T, templatesPath string, s3BucketName string, lockTableName string, ...) string
- func CreateTmpTerragruntConfigContent(t *testing.T, contents string, configFileName string) string
- func CreateTmpTerragruntConfigWithParentAndChild(t *testing.T, parentPath string, childRelPath string, s3BucketName string, ...) string
- func DeleteS3Bucket(t *testing.T, awsRegion string, bucketName string, ...)
- func DeleteS3BucketE(t *testing.T, awsRegion string, bucketName string, ...) error
- func ExpectedWrongCommandErr(command string) error
- func FileIsInFolder(t *testing.T, name string, path string) bool
- func FindFilesWithExtension(dir string, ext string) ([]string, error)
- func GetPathRelativeTo(t *testing.T, path string, basePath string) string
- func GetPathsRelativeTo(t *testing.T, basePath string, paths []string) []string
- func IsTerraform() bool
- func LogBufferContentsLineByLine(t *testing.T, out bytes.Buffer, label string)
- func RemoveFile(t *testing.T, path string)
- func RemoveFolder(t *testing.T, path string)
- func RunNetworkMirrorServer(t *testing.T, ctx context.Context, urlPrefix, providerDir, token string) *url.URL
- func RunTerragrunt(t *testing.T, command string)
- func RunTerragruntCommand(t *testing.T, command string, writer io.Writer, errwriter io.Writer) error
- func RunTerragruntCommandWithOutput(t *testing.T, command string) (string, string, error)
- func RunTerragruntRedirectOutput(t *testing.T, command string, writer io.Writer, errwriter io.Writer)
- func RunTerragruntValidateInputs(t *testing.T, moduleDir string, extraArgs []string, isSuccessTest bool)
- func RunTerragruntVersionCommand(t *testing.T, ver string, command string, writer io.Writer, ...) error
- func RunValidateAllWithIncludeAndGetIncludedModules(t *testing.T, rootModulePath string, includeModulePaths []string, ...) []string
- func TestRunAllPlan(t *testing.T, args string) (string, string, string, error)
- func UniqueID() string
- func ValidateOutput(t *testing.T, outputs map[string]TerraformOutput, key string, ...)
- func WrappedBinary() string
- type FakeProvider
- type TerraformOutput
Constants ¶
const ( TerraformFolder = ".terraform" TerraformState = "terraform.tfstate" TerraformRemoteStateS3Region = "us-west-2" TerraformStateBackup = "terraform.tfstate.backup" TerragruntCache = ".terragrunt-cache" TerraformBinary = "terraform" TofuBinary = "tofu" TerragruntDebugFile = "terragrunt-debug.tfvars.json" // Repeated right now, but it might not be later. TestFixtureOutDir = "fixtures/out-dir" )
Variables ¶
var RootFolder = "/"
Functions ¶
func CleanupTerraformFolder ¶ added in v0.68.13
func CleanupTerragruntFolder ¶ added in v0.68.13
func CopyAndFillMapPlaceholders ¶ added in v0.68.13
func CopyEnvironment ¶ added in v0.68.13
func CopyTerragruntConfigAndFillPlaceholders ¶ added in v0.68.13
func CreateEmptyStateFile ¶ added in v0.68.13
func CreateTmpTerragruntConfig ¶ added in v0.68.13
func CreateTmpTerragruntConfigContent ¶ added in v0.68.13
func CreateTmpTerragruntConfigWithParentAndChild ¶ added in v0.68.13
func DeleteS3Bucket ¶ added in v0.68.13
func DeleteS3Bucket(t *testing.T, awsRegion string, bucketName string, opts ...options.TerragruntOptionsFunc)
DeleteS3Bucket deletes the specified S3 bucket to clean up after a test, and fails the test if there was an error.
func DeleteS3BucketE ¶ added in v0.68.13
func DeleteS3BucketE(t *testing.T, awsRegion string, bucketName string, opts ...options.TerragruntOptionsFunc) error
DeleteS3BucketE deletes the specified S3 bucket potentially with error to clean up after a test.
func ExpectedWrongCommandErr ¶ added in v0.68.13
ExpectedWrongCommandErr - return expected error message for wrong command
func FileIsInFolder ¶ added in v0.68.13
func FindFilesWithExtension ¶ added in v0.68.13
func GetPathRelativeTo ¶ added in v0.68.13
func GetPathsRelativeTo ¶ added in v0.68.13
func IsTerraform ¶ added in v0.68.13
func IsTerraform() bool
func LogBufferContentsLineByLine ¶ added in v0.68.13
func RemoveFile ¶ added in v0.68.13
func RemoveFolder ¶ added in v0.68.13
func RunNetworkMirrorServer ¶ added in v0.68.13
func RunTerragrunt ¶ added in v0.68.13
func RunTerragruntCommand ¶ added in v0.68.13
func RunTerragruntCommandWithOutput ¶ added in v0.68.13
func RunTerragruntRedirectOutput ¶ added in v0.68.13
func RunTerragruntValidateInputs ¶ added in v0.68.13
func RunTerragruntVersionCommand ¶ added in v0.68.13
func RunValidateAllWithIncludeAndGetIncludedModules ¶ added in v0.68.13
func TestRunAllPlan ¶ added in v0.68.13
func UniqueID ¶ added in v0.68.13
func UniqueID() string
UniqueID returns a unique (ish) id we can attach to resources and tfstate files so they don't conflict with each other Uses base 62 to generate a 6 character string that's unlikely to collide with the handful of tests we run in parallel. Based on code here: http://stackoverflow.com/a/9543797/483528
func ValidateOutput ¶ added in v0.68.13
func ValidateOutput(t *testing.T, outputs map[string]TerraformOutput, key string, value interface{})
func WrappedBinary ¶ added in v0.68.13
func WrappedBinary() string
WrappedBinary - return which binary will be wrapped by Terragrunt, useful in CICD to run same tests against tofu and terraform
Types ¶
type FakeProvider ¶ added in v0.68.13
type FakeProvider struct { RegistryName string Namespace string Name string Version string PlatformOS string PlatformArch string }
func (*FakeProvider) CreateMirror ¶ added in v0.68.13
func (provider *FakeProvider) CreateMirror(t *testing.T, rootDir string)
type TerraformOutput ¶ added in v0.68.13
type TerraformOutput struct { Sensitive bool `json:"Sensitive"` Type interface{} `json:"Type"` Value interface{} `json:"Value"` }