mocks

package
v0.0.0-...-437b0eb Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2017 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigMaps

func ConfigMaps(names ...string) runtime.Object

ConfigMaps generates sample ConfigMapList collection object

func MakeConfigMap

func MakeConfigMap(name string) *v1.ConfigMap

MakeConfigMap generates sample ConfigMap object

func MakeDaemonSet

func MakeDaemonSet(name string) *extbeta1.DaemonSet

MakeDaemonSet creates a daemonset base in its name

func MakeDependency

func MakeDependency(parent, child string, label ...string) *client.Dependency

MakeDependency generates Dependency object

func MakeDeployment

func MakeDeployment(name string) *extbeta1.Deployment

MakeDeployment creates mock Deployment

func MakeFlow

func MakeFlow(name string) *client.ResourceDefinition

MakeFlow generates sample Flow resource definition

func MakeFlowParameter

func MakeFlowParameter(defaultValue string) client.FlowParameter

MakeFlowParameter creates stample Flow parameter object

func MakeJob

func MakeJob(name string) *batchapiv1.Job

MakeJob generates sample Job object

func MakePersistentVolumeClaim

func MakePersistentVolumeClaim(name string) *v1.PersistentVolumeClaim

MakePersistentVolumeClaim creates a persistentVolumeClaim based on its name

func MakePetSet

func MakePetSet(name string) *appsalpha1.PetSet

MakePetSet returns a new K8s PetSet object for the client to return. If it's name is "fail" it will have labels that will cause it's underlying mock Pods to fail.

func MakePod

func MakePod(name string) *v1.Pod

MakePod generates sample Pod object

func MakeReplicaSet

func MakeReplicaSet(name string) *extbeta1.ReplicaSet

MakeReplicaSet generates sample ReplicaSet object

func MakeResourceDefinition

func MakeResourceDefinition(name string) *client.ResourceDefinition

MakeResourceDefinition generates sample ResourceDefinition object

func MakeSecret

func MakeSecret(name string) *v1.Secret

MakeSecret generates sample Secret object

func MakeService

func MakeService(name string) *v1.Service

MakeService creates a service based on its name

func MakeServiceAccount

func MakeServiceAccount(name string) *v1.ServiceAccount

MakeServiceAccount generates sample ServiceAccount object

func MakeStatefulSet

func MakeStatefulSet(name string) *appsbeta1.StatefulSet

MakeStatefulSet returns a new K8s StatefulSet object for the client to return. If it's name is "fail" it will have labels that will cause it's underlying mock Pods to fail.

func NewClient

func NewClient(objects ...runtime.Object) client.Interface

NewClient returns new fake client

func NewClient1_4

func NewClient1_4(objects ...runtime.Object) client.Interface

NewClient1_4 returns fake client for K8s 1.4.x

func NewClientWithFake

func NewClientWithFake(objects ...runtime.Object) (client.Interface, *testing.Fake)

NewClientWithFake returns new fake client and *testing.Fake object that can be used to catch client events

func ServiceAccounts

func ServiceAccounts(names ...string) runtime.Object

ServiceAccounts generates sample ServiceAccountList collection object

Types

type CounterWithMemo

type CounterWithMemo struct {
	sync.Mutex
	// contains filtered or unexported fields
}

CounterWithMemo is a counter with atomic increment and decrememt and memoization of miminum and maximum values of the counter

func NewCounterWithMemo

func NewCounterWithMemo() *CounterWithMemo

NewCounterWithMemo creates new instance of CounterWithMemo

func (*CounterWithMemo) Dec

func (c *CounterWithMemo) Dec()

Dec atomically decrements the value of the counter

func (*CounterWithMemo) Inc

func (c *CounterWithMemo) Inc()

Inc atomically increments the value of the counter

func (*CounterWithMemo) Max

func (c *CounterWithMemo) Max() int

Max returns maximum value that counter reached

func (*CounterWithMemo) Min

func (c *CounterWithMemo) Min() int

Min returns minimum value that counter reached

type CountingResource

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

CountingResource is a fake resource that becomes ready after given timeout. It also increases the counter when started and decreases it when becomes ready

func NewCountingResource

func NewCountingResource(key string, counter *CounterWithMemo, timeout time.Duration) *CountingResource

NewCountingResource creates new instance of CountingResource

func (*CountingResource) Create

func (c *CountingResource) Create() error

Create increments counter and sets creation time

func (*CountingResource) Delete

func (c *CountingResource) Delete() error

Delete does nothing

func (CountingResource) Key

func (c CountingResource) Key() string

Key returns a key of the CountingResource

func (*CountingResource) Meta

func (c *CountingResource) Meta(string) interface{}

Meta returns empty string

func (*CountingResource) NameMatches

func (c *CountingResource) NameMatches(_ client.ResourceDefinition, _ string) bool

NameMatches returns true

func (*CountingResource) New

New returns new fake resource

func (*CountingResource) NewExisting

NewExisting returns new existing resource

func (*CountingResource) Status

Status returns a status of the CountingResource. It also updates the status after provided timeout and decrements counter

type Resource

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

Resource is a fake resource

func NewResource

func NewResource(key string, status interfaces.ResourceStatus) *Resource

NewResource creates new instance of Resource

func NewResourceWithMeta

func NewResourceWithMeta(key string, status interfaces.ResourceStatus, meta map[string]interface{}) *Resource

NewResourceWithMeta creates new instance of Resource

func (*Resource) Create

func (c *Resource) Create() error

Create does nothing

func (*Resource) Delete

func (c *Resource) Delete() error

Delete does nothing

func (Resource) Key

func (c Resource) Key() string

Key returns a key of the Resource

func (*Resource) Meta

func (c *Resource) Meta(key string) interface{}

Meta returns empty string

func (*Resource) NameMatches

func (c *Resource) NameMatches(_ client.ResourceDefinition, _ string) bool

NameMatches returns true

func (*Resource) New

New returns new fake resource

func (*Resource) NewExisting

func (c *Resource) NewExisting(name string, _ client.Interface) interfaces.BaseResource

NewExisting returns new existing resource

func (*Resource) Status

func (c *Resource) Status(meta map[string]string) (interfaces.ResourceStatus, error)

Status returns a status of the Resource

Jump to

Keyboard shortcuts

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