Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AzureRmAndRequiredProviders setuptest.PrepFunc = func(resp setuptest.Response) error { if err := createAzureRmProvidersFile(resp.TmpDir); err != nil { return err } return generateRequiredProvidersFile(newRequiredProvidersData(), filepath.Clean(resp.TmpDir+"/terraform.tf")) }
AzureRmAndRequiredProviders is a setuptest.SetupTestPrepFunc that will create
- a required providers file in the given temporary directory (with version constraints from env vars) - a azurerm providers file in the given temporary directory
var RequiredProviders setuptest.PrepFunc = func(resp setuptest.Response) error { return generateRequiredProvidersFile(newRequiredProvidersData(), filepath.Clean(resp.TmpDir+"/terraform.tf")) }
RequiredProviders is a setuptest.SetupTestPrepFunc that will create a required providers file in the given temporary directory.
Functions ¶
func GetLogger ¶
GetLogger returns a logger that can be used for testing. The default logger will discard the Terraform output. Set TERRATEST_LOGGER to a non empty value to enable verbose logging.
func GetTestDir ¶
GetTestDir returns the directory of the test file.
func PreCheckDeployTests ¶
PreCheckDeployTests ensures the correct environment variables are set for the deployment tests to run.
func RandomHex ¶
RandomHex generates a random hex string of the given byte length. Uses crypto/rand for generating the random bytes not math/rand as we kept getting the same results from the math/rand generator.
func SanitiseErrorMessage ¶
SanitiseErrorMessage replaces the newline characters in an error.Error() output with a single space to allow us to check for the entire error message. We need to do this because Terraform adds newline characters depending on the width of the console window. TODO: Test on Windows if we get \r\n instead of just \n.
Types ¶
type RequiredProvidersData ¶
RequiredProvidersData is the data struct for the Terraform required providers block. It should ordinarily be generated using utils.NewRequiredProvidersData().