Documentation ¶
Index ¶
- func CheckResourceAttrFunc(name, key string, valueFunc interface{}) resource.TestCheckFunc
- func CheckResourceExists(name string, k KeyFunc) resource.TestCheckFunc
- func CheckResourcesDestroyed(resType string, k KeyFunc) resource.TestCheckFunc
- func CreateClient() (*hcloud.Client, error)
- func GetErrChan(args mock.Arguments, i int) chan error
- func GetIntChan(args mock.Arguments, i int) chan int
- func LiftTCF(f func() error) resource.TestCheckFunc
- func ProjectRoot(t *testing.T) string
- func RandTLSCert(orgName string) (string, string, error)
- type KeyFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResourceAttrFunc ¶
func CheckResourceAttrFunc(name, key string, valueFunc interface{}) resource.TestCheckFunc
CheckResourceAttrFunc uses valueFunc to obtain the expected attribute value.
This allows to delay determining the expected value to just before the moment it is checked.
The valueFunc may either be a func() string or a func() []string. If valueFunc is a func() []string it is enough if the resource attribute matches any value in the string slice returned by valueFunc.
func CheckResourceExists ¶
func CheckResourceExists(name string, k KeyFunc) resource.TestCheckFunc
CheckResourceExists checks that a resource with the passed name exists.
CheckResourceExists uses k to actually retrieve the resource from the Hetzner Cloud backend.
func CheckResourcesDestroyed ¶
func CheckResourcesDestroyed(resType string, k KeyFunc) resource.TestCheckFunc
CheckResourcesDestroyed checks if resources of resType do not exist in the Hetzner Cloud backend anymore.
func CreateClient ¶
CreateClient creates a new *hcloud.Client which authenticates using the HCLOUD_TOKEN variable.
func GetErrChan ¶ added in v1.24.1
GetErrChan tries to cast the result of args.Get(i) to a chan error.
If the result of args.Get(i) is nil, nil is returned. If casting fails, GetErrChan panics
func GetIntChan ¶ added in v1.24.1
GetIntChan tries to cast the result of args.Get(i) to a chan int.
If the result of args.Get(i) is nil, nil is returned. If casting fails, GetIntChan panics
func LiftTCF ¶
func LiftTCF(f func() error) resource.TestCheckFunc
LiftTCF lifts f to a resource.TestCheckFunc.
func ProjectRoot ¶
ProjectRoot starts at the current working directory and looks for the projects root directory, i.e. the directory containing the .git directory.
ProjectRoot stops as soon as it found the .git directory, or upon reaching the users home directory. In the later case it fails the test.