testing

package
v0.3.0-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: Apache-2.0 Imports: 18 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 CheckClusterClientActions

func CheckClusterClientActions(
	store *clusterclientstore.Store,
	clusters []*ClusterFixture,
	ua string,
	t *testing.T,
)

func CheckEvents

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

func ClusterClientStore

func ClusterClientStore(
	stopCh chan struct{},
	clusterNames []string,
	clientBuilderFunc clusterclientstore.ClientBuilderFunc,
) *clusterclientstore.Store

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 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 ClusterFixture

type ClusterFixture struct {
	Name string
	// contains filtered or unexported fields
}

func NewClusterFixture

func NewClusterFixture(name string) *ClusterFixture

func (*ClusterFixture) AddMany

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

func (*ClusterFixture) AddOne

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

func (*ClusterFixture) Expect

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

func (*ClusterFixture) ExpectedActions

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

func (*ClusterFixture) Objects

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

type FakeClusterClientStore

type FakeClusterClientStore struct {

	// Passed to the registered event handler callbacks.
	FakeClusterNames []string
	// contains filtered or unexported fields
}

FakeClusterClientStore stores only one informer and fake clientset, and no matter what cluster name it's called with, returns the same clientset and informer.

It also supports callbacks, meaning that when it's passed into a controller, the controller can register callback and be notified when the Run() method on FakeClusterClientstore is called.

func NewFakeClusterClientStore

func NewFakeClusterClientStore(
	fakeClient *fake.Clientset,
	informer informers.SharedInformerFactory,
	fakeClusterNames []string,
) *FakeClusterClientStore

func (*FakeClusterClientStore) AddEventHandlerCallback

func (s *FakeClusterClientStore) AddEventHandlerCallback(eventHandlerCallback clusterclientstore.EventHandlerRegisterFunc)

func (*FakeClusterClientStore) AddSubscriptionCallback

func (s *FakeClusterClientStore) AddSubscriptionCallback(subscriptionCallback clusterclientstore.SubscriptionRegisterFunc)

func (*FakeClusterClientStore) GetClient

func (s *FakeClusterClientStore) GetClient(clusterName string, ua string) (kubernetes.Interface, 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