templatertesting

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSchemaAnnotations

func AddSchemaAnnotations(t *testing.T, schema *v1alpha1.Schema, dynObjects []runtime.Object) error

AddSchemaAnnotations adds the schema annotation to the external secret Unstructured objects

func AssertValidJSON

func AssertValidJSON(t *testing.T, text, message string)

AssertValidJSON asserts that the given text is valid JSON

func AssertValidXML

func AssertValidXML(t *testing.T, text, message string)

AssertValidXML asserts that the given text is valid XML

Types

type ExternalSecret

type ExternalSecret struct {
	Location       string
	Name           string
	Value          secretstore.SecretValue
	ExternalSecret v1.ExternalSecret
}

type Runner

type Runner struct {
	// TestCases the test cases to run
	TestCases []TestCase

	// SchemaFile the schema file to load for the templates
	SchemaFile string

	// Namespace optional namespace - defaults to 'jx'
	Namespace string

	// Dir the directory used to detect the jx-requirements.yml file if none is supplied on the test case
	Dir string

	// KubeObjects so you can define default secrets
	KubeObjects []runtime.Object
}

Runner runs the test harness

func (*Runner) Run

func (r *Runner) Run(t *testing.T)

Run runs the test cases

type TestCase

type TestCase struct {
	// GenerateTestOutput to regenerate the expected output
	GenerateTestOutput bool

	// ObjectName name of the object in the schema
	ObjectName string

	// Property name to render; this name is used to find the template in the schema
	Property string

	// TestName is the name of the test
	TestName string

	// ExpectedFile expected file name to compare the generated results against
	ExpectedFile string

	// Format the text format of the output used to perform additional validation
	Format string

	// Dir the directory used to detect the jx-requirements.yml file if none is supplied
	Dir string

	// Requirements the jx-requirements.yml used to parameterize the template
	Requirements *jxcore.RequirementsConfig

	// KubeObjects extra kubernetes resources such as Secrets for the test case
	KubeObjects []runtime.Object

	// VerifyFn performs a custom verify of the generated value
	VerifyFn func(*testing.T, string)

	ExternalSecrets []ExternalSecret

	ExternalSecretStorageType secretstore.SecretStoreType
}

TestCase represents a test case

Jump to

Keyboard shortcuts

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