Documentation ¶
Index ¶
- Constants
- Variables
- func CompareResources(uc UtilContext, path string)
- func DeleteResource(uc UtilContext, path string)
- func DeployResource(uc UtilContext, path string)
- func DirExists(path string) (bool, error)
- func ResourceDoesNotExists(uc UtilContext, path string)
- type Case
- type Expectation
- type UtilContext
Constants ¶
const (
CasesDir = "./testdata/declarative"
)
Variables ¶
var CompareResourceProcs = map[string]func(expected, actual *unstructured.Unstructured) (bool, error){
"Secret": secretsAreEqual,
"ConfigMap": configMapsAreEqual,
"Deployment": deploymentsAreEqual,
}
CompareResourceProcs maps object kind's to their associated comparison procedures. To add new comparison procedures, ensure they are added to compareResourceProcs and follow the same signature.
Functions ¶
func CompareResources ¶ added in v0.2.0
func CompareResources(uc UtilContext, path string)
CompareResources compares expected resource found locally in path and compares it against the resource found in the k8s cluster accessed via client defined in uc.Opts.
Resource type is inferred dynamically. The resource found in path musth ave a supporting comparison procedure implemented.
See testutil.CompareResourceProcs for supported procedures.
func DeleteResource ¶ added in v0.2.0
func DeleteResource(uc UtilContext, path string)
DeleteResource will delete resource found in path by requesting a generic delete request to the client provided via uc.Opts
func DeployResource ¶ added in v0.2.0
func DeployResource(uc UtilContext, path string)
DeployResource will deploy resource found in path by requesting a generic apply request to the client provided via uc.Opts
func ResourceDoesNotExists ¶ added in v0.2.0
func ResourceDoesNotExists(uc UtilContext, path string)
ResourceDoesNotExists will check against the client provided by uc.Opts whether resource at path exists.
Types ¶
type Case ¶ added in v0.2.0
type Case struct { Description string Config string Deploy []string Expected Expectation }
func GenerateDeclarativeTestCases ¶ added in v0.2.0
func GenerateDeclarativeTestCases() []Case
GenerateDeclarativeTestCases dynamically generate testcases based on resources located in the testdata directory.