testhelpers

package
v3.8.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2018 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProtoDimensionsToMap

func ProtoDimensionsToMap(dims []*sfxproto.Dimension) (m map[string]string)

ProtoDimensionsToMap takes a slice of protobuf dimensions and turns them into a regular map for easier testing.

Types

type FakeK8s

type FakeK8s struct {

	// Used by tests to insert resources for test
	EventInput chan watch.Event
	// contains filtered or unexported fields
}

FakeK8s is a mock K8s API server. It can serve both list and watch requests.

func NewFakeK8s

func NewFakeK8s() *FakeK8s

NewFakeK8s makes a new FakeK8s

func (*FakeK8s) AddSecret

func (f *FakeK8s) AddSecret(secret *v1.Secret)

AddSecret accepts a secret to serve later.

func (*FakeK8s) Close

func (f *FakeK8s) Close()

Close stops the server and all watchers

func (*FakeK8s) ServeHTTP

func (f *FakeK8s) ServeHTTP(rw http.ResponseWriter, r *http.Request)

ServeHTTP handles a single request

func (*FakeK8s) SetInitialList

func (f *FakeK8s) SetInitialList(l interface{})

SetInitialList adds resources to the server state that are served when doing list requests. l can be a list of any of the supported resource types.

func (*FakeK8s) Start

func (f *FakeK8s) Start()

Start creates the server and starts it

func (*FakeK8s) URL

func (f *FakeK8s) URL() string

URL is the of the mock server to point your objects under test to

type ResourceType

type ResourceType int

ResourceType is an enum

const (
	Pods ResourceType = iota
	Deployments
	ReplicationControllers
	DaemonSets
	ReplicaSets
	Secrets
	Namespaces
	Nodes
)

Enum values for ResourceType

Jump to

Keyboard shortcuts

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