Documentation
¶
Overview ¶
Package fixtures provides access to consistent data structures for testing against. Data read from this package must either be constant, or a deep copy of the original template.
Index ¶
- Constants
- Variables
- func AddRegistry(spec *v1.ServiceBrokerConfigSpec, name string, expression interface{})
- func AssertFixtureFieldNotSet(t *testing.T, clients client.Clients, path ...string)
- func AssertFixtureFieldSet(t *testing.T, clients client.Clients, value interface{}, path ...string)
- func BasicConfiguration() *v1.ServiceBrokerConfigSpec
- func BasicConfigurationWithReadiness() *v1.ServiceBrokerConfigSpec
- func BasicResourceStatus(t *testing.T) interface{}
- func BasicSchema() *v1.Schemas
- func BasicSchemaBindingRequired() *v1.Schemas
- func BasicSchemaRequired() *v1.Schemas
- func BasicServiceBindingCreateRequest() *api.CreateServiceBindingRequest
- func BasicServiceInstanceCreateRequest() *api.CreateServiceInstanceRequest
- func BasicServiceInstanceUpdateRequest() *api.UpdateServiceInstanceRequest
- func EmptyConfiguration() *v1.ServiceBrokerConfigSpec
- func MustSetFixtureField(t *testing.T, clients client.Clients, value interface{}, path ...string)
- func SetRegistry(spec *v1.ServiceBrokerConfigSpec, name string, expression interface{})
- type Function
- func Default(arg interface{}) Function
- func GenerateCertificate(key, cn, lifetime, usage, sans, caKey, caCert interface{}) Function
- func GeneratePassword(length, dictionary interface{}) Function
- func GeneratePrivateKey(typ, encoding, bits interface{}) Function
- func NewFunction(fn string, args ...interface{}) Function
- func Parameter(arg interface{}) Function
- func Registry(arg interface{}) Function
- func Required() Function
- type Pipeline
- func NewGenerateCertificatePipeline(key, cn, lifetime, usage, sans, caKey, caCert interface{}) Pipeline
- func NewGeneratePasswordPipeline(length, dictionary interface{}) Pipeline
- func NewGeneratePrivateKeyPipeline(typ, encoding, bits interface{}) Pipeline
- func NewParameterPipeline(arg interface{}) Pipeline
- func NewPipeline(fn Function) Pipeline
- func NewRegistryPipeline(arg interface{}) Pipeline
Constants ¶
const ( // ServiceInstanceName is a name to use for a service instance. ServiceInstanceName = "pinkiepie" // AlternateServiceInstanceName is a name to use for another service instance. AlternateServiceInstanceName = "rainbowdash" // ServiceBindingName is a name to use for a service binding. ServiceBindingName = "spike" // IllegalID is an illegal ID and must not be used as a service or plan ID. IllegalID = "illegal" // BasicConfigurationOfferingID is the symbolic constant UUID used for the basic configuration. BasicConfigurationOfferingID = `dd2cce49-a0ff-4deb-9cbf-b97301fdb87e` // BasicConfigurationPlanID is the symbolic constant UUID used for the basic configuration plan. BasicConfigurationPlanID = `3f525c60-bd66-4b91-8d18-beba57fbc0b8` // BasicConfigurationPlanID2 is the symbolic constant UUID used for the basic configuration plan. BasicConfigurationPlanID2 = `e18fce8d-1f4a-44fa-88c8-e7a52ed50f29` // BasicSchemaParameters is a simple schema for use in parameter validation. BasicSchemaParameters = `{"$schema":"http://json-schema.org/draft-04/schema#","type":"object","properties":{"test":{"type":"number","minimum":1}}}` // BasicSchemaParametersRequired is a simple schema for use in parameter validation. BasicSchemaParametersRequired = `` /* 141-byte string literal not displayed */ // DashboardURL is the expected dashboard URL to be generated. DashboardURL = "http://instance-" + ServiceInstanceName + "." + util.Namespace + ".svc" // OptionalParameter is a template parameter this is optional. OptionalParameter = "hostname" )
Variables ¶
var ( // IllegalTemplateName refers to a template for a non-existent resource // type that can be used to simulate Kubernetes errors. IllegalTemplateName = "illegal" )
Functions ¶
func AddRegistry ¶
func AddRegistry(spec *v1.ServiceBrokerConfigSpec, name string, expression interface{})
AddRegistry appends the requested template expression to the service instance binding registry entry for the first binding.
func AssertFixtureFieldNotSet ¶
AssertFixtureFieldNotSet asserts that the named field in the Kubernetes resource is not set as expected.
func AssertFixtureFieldSet ¶
AssertFixtureFieldSet asserts that the named field in the Kubernetes resource is set as expected.
func BasicConfiguration ¶
func BasicConfiguration() *v1.ServiceBrokerConfigSpec
BasicConfiguration is the absolute minimum valid configuration allowed by the service broker configuration schema.
func BasicConfigurationWithReadiness ¶
func BasicConfigurationWithReadiness() *v1.ServiceBrokerConfigSpec
BasicConfigurationWithReadiness returns the standard configuration with a readiness check added for the resource that is templated.
func BasicResourceStatus ¶
BasicResourceStatus returns the templated resource status that will fulfil the readiness checks defined above. The unstructured application code needs things to be fully unstructured, it's not clever enough to use a raw object type.
func BasicSchema ¶
BasicSchema is schema for service instance create validation with optional parameters.
func BasicSchemaBindingRequired ¶
BasicSchemaBindingRequired is a schema for service binding create validation with required parameters.
func BasicSchemaRequired ¶
BasicSchemaRequired is a schema for service instance create validation with required parameters.
func BasicServiceBindingCreateRequest ¶
func BasicServiceBindingCreateRequest() *api.CreateServiceBindingRequest
BasicServiceBindingCreateRequest is the absolute minimum valid service bindinf create request to use against the basicConfiguration.
func BasicServiceInstanceCreateRequest ¶
func BasicServiceInstanceCreateRequest() *api.CreateServiceInstanceRequest
BasicServiceInstanceCreateRequest is the absolute minimum valid service instance create request to use against the basicConfiguration.
func BasicServiceInstanceUpdateRequest ¶
func BasicServiceInstanceUpdateRequest() *api.UpdateServiceInstanceRequest
BasicServiceInstanceUpdateRequest is the absolute minimum valid service instance update request to use against the basicConfiguration.
func EmptyConfiguration ¶
func EmptyConfiguration() *v1.ServiceBrokerConfigSpec
EmptyConfiguration returns an empty configuration, useful for testing when users really screw up.
func MustSetFixtureField ¶
MustSetFixtureField sets the named field in the fixture Kubernetes resource.
func SetRegistry ¶
func SetRegistry(spec *v1.ServiceBrokerConfigSpec, name string, expression interface{})
SetRegistry sets the service instance binding registry entries for the first binding to the requested template expression.
Types ¶
type Function ¶
type Function string
Function represents a named function that accepts an arbitrary number of arguments. https://golang.org/pkg/text/template/#hdr-Functions
func Default ¶
func Default(arg interface{}) Function
Default generates a function that returns a default if the input it nil.
func GenerateCertificate ¶
func GenerateCertificate(key, cn, lifetime, usage, sans, caKey, caCert interface{}) Function
GenerateCertificate returns a function that generates a certificate.
func GeneratePassword ¶
func GeneratePassword(length, dictionary interface{}) Function
GeneratePassword returns a function that generates a random password string.
func GeneratePrivateKey ¶
func GeneratePrivateKey(typ, encoding, bits interface{}) Function
GeneratePrivateKey returns a function that generates a private key.
func NewFunction ¶
NewFunction creates a new named function.
func Parameter ¶
func Parameter(arg interface{}) Function
Parameter returns a function that looks up a parameter path.
type Pipeline ¶
type Pipeline string
Pipeline represents a pipeline of of go template functions. https://golang.org/pkg/text/template/#hdr-Pipelines
func NewGenerateCertificatePipeline ¶
func NewGenerateCertificatePipeline(key, cn, lifetime, usage, sans, caKey, caCert interface{}) Pipeline
NewGenerateCertificatePipeline creates a pipeline initialized with a generate certificate function.
func NewGeneratePasswordPipeline ¶
func NewGeneratePasswordPipeline(length, dictionary interface{}) Pipeline
NewGeneratePasswordPipeline creates a pipeline initialized with a generate password function.
func NewGeneratePrivateKeyPipeline ¶
func NewGeneratePrivateKeyPipeline(typ, encoding, bits interface{}) Pipeline
NewGeneratePrivateKeyPipeline creates a pipeline initialized with a generate private key function.
func NewParameterPipeline ¶
func NewParameterPipeline(arg interface{}) Pipeline
NewParameterPipeline creates a pipeline initialized with a parameter lookup function.
func NewPipeline ¶
NewPipeline creates a new pipeline from a function. While a pipeline can start with an argument, all our data accessors are through functions so this is the common path.
func NewRegistryPipeline ¶
func NewRegistryPipeline(arg interface{}) Pipeline
NewRegistryPipeline creates a pipeline initialized with a registry lookup function.
func (Pipeline) Required ¶
Required appends a function to a pipeline that sets a default if the input is nil.
func (Pipeline) WithDefault ¶
WithDefault appends a defaulting function to a pipeline.