testing

package
v1.10.13 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOpenAPISchemaFunc added in v1.9.0

func CreateOpenAPISchemaFunc(path string) func() (openapi.Resources, error)

CreateOpenAPISchemaFunc returns a function useful for the TestFactory.

Types

type EmptyResources added in v1.9.0

type EmptyResources struct{}

EmptyResources implement a Resources that just doesn't have any resources.

func (EmptyResources) LookupResource added in v1.9.0

func (f EmptyResources) LookupResource(gvk schema.GroupVersionKind) proto.Schema

LookupResource will always return nil. It doesn't have any resources.

type Fake

type Fake struct {
	Path string
	// contains filtered or unexported fields
}

Fake opens and returns a openapi swagger from a file Path. It will parse only once and then return the same copy everytime.

func (*Fake) OpenAPISchema

func (f *Fake) OpenAPISchema() (*openapi_v2.Document, error)

OpenAPISchema returns the openapi document and a potential error.

type FakeClient

type FakeClient struct {
	Calls int
	Err   error
	// contains filtered or unexported fields
}

FakeClient implements a dummy OpenAPISchemaInterface that uses the fake OpenAPI schema given as a parameter, and count the number of call to the function.

func NewFakeClient

func NewFakeClient(f *Fake) *FakeClient

NewFakeClient creates a new FakeClient from the given Fake.

func (*FakeClient) OpenAPISchema

func (f *FakeClient) OpenAPISchema() (*openapi_v2.Document, error)

OpenAPISchema returns a OpenAPI Document as returned by the fake, but it also counts the number of calls.

type FakeResources added in v1.9.0

type FakeResources struct {
	// contains filtered or unexported fields
}

FakeResources is a wrapper to directly load the openapi schema from a file, and get the schema for given GVK. This is only for test since it's assuming that the file is there and everything will go fine.

func NewFakeResources added in v1.9.0

func NewFakeResources(path string) *FakeResources

NewFakeResources creates a new FakeResources.

func (*FakeResources) LookupResource added in v1.9.0

func (f *FakeResources) LookupResource(gvk schema.GroupVersionKind) proto.Schema

LookupResource will read the schema, parse it and return the resources. It doesn't return errors and will panic instead.

Jump to

Keyboard shortcuts

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