Documentation ¶
Index ¶
- Constants
- func CheckAction(expected, actual kubetesting.Action, t *testing.T)
- func CheckActions(expected, actual []kubetesting.Action, t *testing.T)
- func CheckEvents(expectedOrderedEvents []string, receivedEvents []string, t *testing.T)
- func DeepEqualDiff(expected, actual interface{}) (bool, string)
- func FilterActions(actions []kubetesting.Action) []kubetesting.Action
- func NewDiscoveryAction(_ string) kubetesting.ActionImpl
- func PrettyPrintActions(actions []kubetesting.Action, t *testing.T)
- func ShallowCheckAction(expected, actual kubetesting.Action, t *testing.T)
- func ShallowCheckActions(expected, actual []kubetesting.Action, t *testing.T)
- func YamlDiff(a interface{}, b interface{}) (string, error)
- type ControllerTestFixture
- func (f *ControllerTestFixture) AddCluster() *FakeCluster
- func (f *ControllerTestFixture) AddNamedCluster(name string) *FakeCluster
- func (f *ControllerTestFixture) DynamicClientBuilder(kind *schema.GroupVersionKind, restConfig *rest.Config, ...) dynamic.Interface
- func (f *ControllerTestFixture) Run(stopCh chan struct{})
- type FakeCluster
- type FakeClusterClientStore
- func (s *FakeClusterClientStore) AddCluster(c *FakeCluster)
- func (s *FakeClusterClientStore) AddEventHandlerCallback(c clusterclientstore.EventHandlerRegisterFunc)
- func (s *FakeClusterClientStore) AddSubscriptionCallback(c clusterclientstore.SubscriptionRegisterFunc)
- func (s *FakeClusterClientStore) GetClient(clusterName string, ua string) (kubernetes.Interface, error)
- func (s *FakeClusterClientStore) GetConfig(clusterName string) (*rest.Config, error)
- func (s *FakeClusterClientStore) GetInformerFactory(clusterName string) (informers.SharedInformerFactory, error)
- func (s *FakeClusterClientStore) Run(stopCh <-chan struct{})
Constants ¶
const ( NoResyncPeriod time.Duration = 0 ContextLines = 4 TestNamespace = "test-namespace" TestApp = "shipper-test" TestRegion = "eu-west" TestCluster = "test-cluster" E2ETestNamespaceLabel = "shipper-e2e-test" )
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 DeepEqualDiff ¶ added in v0.8.0
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 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 ControllerTestFixture ¶ added in v0.8.0
type ControllerTestFixture struct { ShipperClient *shipperfake.Clientset ShipperInformerFactory shipperinformers.SharedInformerFactory Clusters map[string]*FakeCluster ClusterClientStore *FakeClusterClientStore Recorder *record.FakeRecorder }
func NewControllerTestFixture ¶ added in v0.8.0
func NewControllerTestFixture(objects ...runtime.Object) *ControllerTestFixture
func (*ControllerTestFixture) AddCluster ¶ added in v0.8.0
func (f *ControllerTestFixture) AddCluster() *FakeCluster
func (*ControllerTestFixture) AddNamedCluster ¶ added in v0.8.0
func (f *ControllerTestFixture) AddNamedCluster(name string) *FakeCluster
func (*ControllerTestFixture) DynamicClientBuilder ¶ added in v0.8.0
func (f *ControllerTestFixture) DynamicClientBuilder( kind *schema.GroupVersionKind, restConfig *rest.Config, cluster *shipper.Cluster, ) dynamic.Interface
func (*ControllerTestFixture) Run ¶ added in v0.8.0
func (f *ControllerTestFixture) Run(stopCh chan struct{})
type FakeCluster ¶ added in v0.7.0
type FakeCluster struct { Name string Client *kubefake.Clientset DynamicClient *fakedynamic.FakeDynamicClient InformerFactory informers.SharedInformerFactory }
func NewNamedFakeCluster ¶ added in v0.7.0
func NewNamedFakeCluster(name string) *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) InitializeDiscovery ¶ added in v0.8.0
func (c *FakeCluster) InitializeDiscovery(resources []*v1.APIResourceList)
func (*FakeCluster) InitializeDynamicClient ¶ added in v0.8.0
func (c *FakeCluster) InitializeDynamicClient(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) AddCluster ¶ added in v0.8.0
func (s *FakeClusterClientStore) AddCluster(c *FakeCluster)
func (*FakeClusterClientStore) AddEventHandlerCallback ¶
func (s *FakeClusterClientStore) AddEventHandlerCallback(c clusterclientstore.EventHandlerRegisterFunc)
func (*FakeClusterClientStore) AddSubscriptionCallback ¶
func (s *FakeClusterClientStore) AddSubscriptionCallback(c clusterclientstore.SubscriptionRegisterFunc)
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{})