Documentation
¶
Overview ¶
Package config implements functionality for supporting native Terraform configuration and variables for testing purposes.
Index ¶
- func BoolVariable(value bool) boolVariable
- func FloatVariable[T constraints.Float](value T) floatVariable
- func IntegerVariable[T constraints.Integer](value T) integerVariable
- func ListVariable(value ...Variable) listVariable
- func MapVariable(value map[string]Variable) mapVariable
- func ObjectVariable(value map[string]Variable) objectVariable
- func SetVariable(value ...Variable) setVariable
- func StaticDirectory(directory string) func(TestStepConfigRequest) string
- func StaticFile(file string) func(TestStepConfigRequest) string
- func StringVariable(value string) stringVariable
- func TestNameDirectory() func(TestStepConfigRequest) string
- func TestNameFile(file string) func(TestStepConfigRequest) string
- func TestStepDirectory() func(TestStepConfigRequest) string
- func TestStepFile(file string) func(TestStepConfigRequest) string
- func TupleVariable(value ...Variable) tupleVariable
- type TestStepConfigFunc
- type TestStepConfigRequest
- type Variable
- type Variables
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BoolVariable ¶
func BoolVariable(value bool) boolVariable
BoolVariable returns boolVariable which implements Variable.
func FloatVariable ¶
func FloatVariable[T constraints.Float](value T) floatVariable
FloatVariable returns floatVariable which implements Variable.
func IntegerVariable ¶
func IntegerVariable[T constraints.Integer](value T) integerVariable
IntegerVariable returns integerVariable which implements Variable.
func ListVariable ¶
func ListVariable(value ...Variable) listVariable
ListVariable returns listVariable which implements Variable.
func MapVariable ¶
MapVariable returns mapVariable which implements Variable.
func ObjectVariable ¶
ObjectVariable returns objectVariable which implements Variable.
func SetVariable ¶
func SetVariable(value ...Variable) setVariable
SetVariable returns setVariable which implements Variable.
func StaticDirectory ¶
func StaticDirectory(directory string) func(TestStepConfigRequest) string
StaticDirectory returns the supplied directory.
func StaticFile ¶
func StaticFile(file string) func(TestStepConfigRequest) string
StaticFile returns the supplied file.
func StringVariable ¶
func StringVariable(value string) stringVariable
StringVariable returns stringVariable which implements Variable.
func TestNameDirectory ¶
func TestNameDirectory() func(TestStepConfigRequest) string
TestNameDirectory returns the name of the test prefixed with "testdata".
For example, given test code:
func TestExampleCloudThing_basic(t *testing.T) { resource.Test(t, resource.TestCase{ Steps: []resource.TestStep{ { ConfigDirectory: config.TestNameDirectory(), }, }, }) }
The testing configurations will be expected in the testdata/TestExampleCloudThing_basic/ directory.
func TestNameFile ¶
func TestNameFile(file string) func(TestStepConfigRequest) string
TestNameFile returns the name of the test suffixed with the supplied file and prefixed with "testdata".
For example, given test code:
func TestExampleCloudThing_basic(t *testing.T) { resource.Test(t, resource.TestCase{ Steps: []resource.TestStep{ { ConfigFile: config.TestNameFile("test.tf"), }, }, }) }
The testing configuration will be expected in the testdata/TestExampleCloudThing_basic/test.tf file.
func TestStepDirectory ¶
func TestStepDirectory() func(TestStepConfigRequest) string
TestStepDirectory returns the name of the test suffixed with the test step number and prefixed with "testdata".
For example, given test code:
func TestExampleCloudThing_basic(t *testing.T) { resource.Test(t, resource.TestCase{ Steps: []resource.TestStep{ { ConfigDirectory: config.TestStepDirectory(), }, }, }) }
The testing configurations will be expected in the testdata/TestExampleCloudThing_basic/1 directory as TestStepConfigRequest.StepNumber is one-based.
func TestStepFile ¶
func TestStepFile(file string) func(TestStepConfigRequest) string
TestStepFile returns the name of the test suffixed with the test step number and the supplied file, and prefixed with "testdata".
For example, given test code:
func TestExampleCloudThing_basic(t *testing.T) { resource.Test(t, resource.TestCase{ Steps: []resource.TestStep{ { ConfigFile: config.TestStepFile("test.tf"), }, }, }) }
The testing configuration will be expected in the testdata/TestExampleCloudThing_basic/1/test.tf file as TestStepConfigRequest.StepNumber is one-based.
func TupleVariable ¶
func TupleVariable(value ...Variable) tupleVariable
TupleVariable returns tupleVariable which implements Variable.
Types ¶
type TestStepConfigFunc ¶
type TestStepConfigFunc func(TestStepConfigRequest) string
TestStepConfigFunc is the callback type used with acceptance tests to specify a string which either identifies a directory containing Terraform configuration files, or a file that contains Terraform configuration.
func (TestStepConfigFunc) Exec ¶
func (f TestStepConfigFunc) Exec(req TestStepConfigRequest) string
Exec executes TestStepConfigFunc if it is not nil, otherwise an empty string is returned.
type TestStepConfigRequest ¶
TestStepConfigRequest defines the request supplied to types implementing TestStepConfigFunc. StepNumber is one-based and is used in the predefined helper functions:
TestName is used in the predefined helper functions: