testhelpers

package
v1.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIfResourceNestedAttributeContainsResourceAttribute

func CheckIfResourceNestedAttributeContainsResourceAttribute(firstResourceName string, firstResourceKeys []string, secondResourceName string, secondResourceKey string) resource.TestCheckFunc

CheckIfResourceNestedAttributeContainsResourceAttribute runs a value check between the first resource and second resource. The first resource attribute is assumed to have a only a single level of depth. The second resource attribute is assumed to be a regular attribute. TODO: - refactor this logic into the Resource method - add support in the Attribute method to add special values (*) in the name? - better support for collection testing?

func Resource

func Resource(address string, checks ...AttributeCheck) resource.TestCheckFunc

Resource runs an arbitrary number of checks on a resource. The resource is assumed to be in the root module.

Types

type AttributeCheck

type AttributeCheck func(map[string]string) error

AttributeCheck is a check on a single attribute.

func Attribute

func Attribute(name string, check ValueCheck) AttributeCheck

Attribute runs a value check function against an attribute passed by name.

func AttributeNotPresent

func AttributeNotPresent(name string) AttributeCheck

AttributeNotPresent ensures that an attribute is not set on the resource.

func CheckInList added in v1.1.5

func CheckInList(checks ...AttributeCheck) AttributeCheck

CheckInList will group attributes by index and run the check on each group. If check passes for a single group, the check will pass.

func Nested added in v1.1.5

func Nested(attributeName string, check AttributeCheck) AttributeCheck

Nested will scope down attribute checks to a nested attribute. The nested attributes will be stripped of the attributeName prefix.

func SetContains added in v0.1.16

func SetContains(name string, values ...string) AttributeCheck

SetContains checks the set contains all specified values

func SetDoesNotContain added in v0.1.16

func SetDoesNotContain(name string, values ...string) AttributeCheck

SetDoesNotContain checks the set does not contain any of the specified values

func SetEquals

func SetEquals(name string, values ...string) AttributeCheck

SetEquals checks for complete set equality.

type ValueCheck

type ValueCheck func(string) error

ValueCheck is a check on an attribute value.

func Contains

func Contains(needle string) ValueCheck

Contains checks for a patrial match match.

func Equals

func Equals(expected string) ValueCheck

Equals checks for equality against the expected value.

func IsEmpty

func IsEmpty() ValueCheck

IsEmpty checks that the expected value is empty.

func IsNotEmpty

func IsNotEmpty() ValueCheck

IsNotEmpty checks that the expected value is not empty.

func StartsWith

func StartsWith(prefix string) ValueCheck

StartsWith checks for a prefix match.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL