testing

package
v0.7.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NoResyncPeriod time.Duration = 0

	ContextLines = 4

	TestNamespace = "test-namespace"
	TestLabel     = "shipper-e2e-test"

	TestRegion = "eu-west"
)

Variables

This section is empty.

Functions

func CheckAction

func CheckAction(expected, actual kubetesting.Action, t *testing.T)

CheckAction compares two individual actions and calls Errorf on t if it finds a difference.

func CheckActions

func CheckActions(expected, actual []kubetesting.Action, t *testing.T)

CheckActions takes a slice of expected actions and a slice of observed actions (typically obtained from fakeClient.Actions()) and compares them. Calls Errorf on t for every difference it finds.

func CheckEvents

func CheckEvents(expectedOrderedEvents []string, receivedEvents []string, t *testing.T)

func FilterActions

func FilterActions(actions []kubetesting.Action) []kubetesting.Action

FilterActions, given a slice of observed actions, returns only those that change state. Useful for reducing the number of actions needed to check in tests.

func NewDiscoveryAction added in v0.5.0

func NewDiscoveryAction(_ string) kubetesting.ActionImpl

func NewFailingFakeClusterClientStore added in v0.7.0

func NewFailingFakeClusterClientStore() clusterclientstore.Interface

func PrettyPrintActions added in v0.5.0

func PrettyPrintActions(actions []kubetesting.Action, t *testing.T)

PrettyPrintActions pretty-prints a slice of actions, useful for creating a human-readable list for debugging.

func ShallowCheckAction

func ShallowCheckAction(expected, actual kubetesting.Action, t *testing.T)

ShallowCheckAction checks the verb, resource, and namespace without looking at the objects involved. This is a stand-in until we port the Installation controller to not use 'nil' as the object involved in the kubetesting.Actions it expects.

func ShallowCheckActions

func ShallowCheckActions(expected, actual []kubetesting.Action, t *testing.T)

ShallowCheckActions takes a slice of expected actions and a slice of observed actions (typically obtained from fakeClient.Actions()) and compares them shallowly. Calls Errorf on t for every difference it finds.

Types

type FailingFakeClusterClientStore added in v0.7.0

type FailingFakeClusterClientStore struct {
	FakeClusterClientStore
}

FailingFakeClusterClientStore is an implementation of clusterclientstore.Interface that always fails when trying to get clients for any cluster.

func (*FailingFakeClusterClientStore) GetClient added in v0.7.0

func (s *FailingFakeClusterClientStore) GetClient(clusterName string, ua string) (kubernetes.Interface, error)

type FakeCluster added in v0.7.0

type FakeCluster struct {
	Name string

	Client          *kubefake.Clientset
	DynamicClient   *fakedynamic.FakeDynamicClient
	InformerFactory informers.SharedInformerFactory
	// contains filtered or unexported fields
}

func NewFakeCluster added in v0.7.0

func NewFakeCluster(
	client *kubefake.Clientset,
	dynamic *fakedynamic.FakeDynamicClient,
) *FakeCluster

func NewNamedFakeCluster added in v0.7.0

func NewNamedFakeCluster(
	name string,
	client *kubefake.Clientset,
	dynamic *fakedynamic.FakeDynamicClient,
) *FakeCluster

func (*FakeCluster) AddMany added in v0.7.0

func (c *FakeCluster) AddMany(objects []runtime.Object)

func (*FakeCluster) AddOne added in v0.7.0

func (c *FakeCluster) AddOne(object runtime.Object)

func (*FakeCluster) Expect added in v0.7.0

func (c *FakeCluster) Expect(actions ...kubetesting.Action)

func (*FakeCluster) ExpectedActions added in v0.7.0

func (c *FakeCluster) ExpectedActions() []kubetesting.Action

func (*FakeCluster) Objects added in v0.7.0

func (c *FakeCluster) Objects() []runtime.Object

type FakeClusterClientStore

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

FakeClusterClientStore is a fake implementation of a ClusterClientStore, allowing you to provide your own clientsets.

func NewFakeClusterClientStore

func NewFakeClusterClientStore(clusters map[string]*FakeCluster) *FakeClusterClientStore

func (*FakeClusterClientStore) AddEventHandlerCallback

func (*FakeClusterClientStore) AddSubscriptionCallback

func (*FakeClusterClientStore) GetClient

func (s *FakeClusterClientStore) GetClient(clusterName string, ua string) (kubernetes.Interface, error)

func (*FakeClusterClientStore) GetConfig added in v0.7.0

func (s *FakeClusterClientStore) GetConfig(clusterName string) (*rest.Config, error)

func (*FakeClusterClientStore) GetInformerFactory

func (s *FakeClusterClientStore) GetInformerFactory(clusterName string) (informers.SharedInformerFactory, error)

func (*FakeClusterClientStore) Run

func (s *FakeClusterClientStore) Run(stopCh <-chan struct{})

Jump to

Keyboard shortcuts

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