Documentation ¶
Index ¶
- func BuildBlueprintStringParams(candidateParams []StringParam) ([]v1alpha1.BlueprintParam, error)
- func Cmd(argv ...string) *cmd
- func Execute()
- func YTT() *ytt
- type FailedTest
- type Inputs
- type StringParam
- type TemplateTestCase
- type TemplateTestExpectation
- type TemplateTestGivens
- type TemplateTestSuite
- type TestFailError
- type Values
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildBlueprintStringParams ¶
func BuildBlueprintStringParams(candidateParams []StringParam) ([]v1alpha1.BlueprintParam, error)
BuildBlueprintStringParams is a helper method for creating string BlueprintParams for Givens. BlueprintParams that hold other valid JSON values must be constructed by hand.
Types ¶
type FailedTest ¶
type FailedTest struct {
// contains filtered or unexported fields
}
type Inputs ¶ added in v0.6.0
type Inputs struct { Sources map[string]templates.SourceInput Images map[string]templates.ImageInput Configs map[string]templates.ConfigInput Deployment *templates.SourceInput }
type StringParam ¶
StringParam is a helper struct for use with the BuildBlueprintStringParams method Either a Value or a DefaultValue should be specified for every StringParam A Name is required for every StringParam
type TemplateTestCase ¶
type TemplateTestCase struct { Given TemplateTestGivens Expect TemplateTestExpectation IgnoreMetadata bool IgnoreOwnerRefs bool IgnoreLabels bool IgnoreMetadataFields []string Focus bool }
TemplateTestCase is an individual template test. Given and Expect values must be provided. Fields in the expected object's metadata may be ignored When run as part of a TemplateTestSuite, an individual case(s) may be focused. This will exercise the individual test(s). Note that the overall suite will fail (preventing focused tests from passing CI).
func (*TemplateTestCase) Run ¶
func (c *TemplateTestCase) Run() error
type TemplateTestExpectation ¶
type TemplateTestExpectation struct { ExpectedFile string ExpectedObject client.Object ExpectedUnstructured *unstructured.Unstructured }
TemplateTestExpectation must provide the expected object as an object, an unstructured.Unstructured, or as a yaml file.
type TemplateTestGivens ¶
type TemplateTestGivens struct { TemplateFile string Template templateType WorkloadFile string Workload *v1alpha1.Workload BlueprintParams []v1alpha1.BlueprintParam BlueprintParamsFile string YttValues Values YttFiles []string BlueprintInputs *Inputs BlueprintInputsFile string // contains filtered or unexported fields }
TemplateTestGivens must specify a template and a workload. These can be specified as yaml files or as objects. If the template is a yaml file, it may be pre-processed with ytt and values provided as objects or in a values yaml file. Any outputs expected from earlier templates in a supply chain may be provided in BlueprintInputs. Params may be specified in the BlueprintParams
type TemplateTestSuite ¶
type TemplateTestSuite map[string]*TemplateTestCase
TemplateTestSuite is a collection of named template tests which may be run together
func (*TemplateTestSuite) Assert ¶
func (s *TemplateTestSuite) Assert() ([]string, []*FailedTest)
Assert allows testing a TemplateTestSuite when a *testing.T is not available, e.g. when tests are not run from 'go test' It returns a list of the named tests that passed and a list of the named tests that failed with their errors
func (*TemplateTestSuite) HasFocusedTests ¶
func (s *TemplateTestSuite) HasFocusedTests() bool
func (*TemplateTestSuite) Run ¶
func (s *TemplateTestSuite) Run(t *testing.T)
func (*TemplateTestSuite) RunConcurrently ¶
func (s *TemplateTestSuite) RunConcurrently(t *testing.T)
type TestFailError ¶
type TestFailError struct {
// contains filtered or unexported fields
}
func (TestFailError) Error ¶
func (t TestFailError) Error() string