testing

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PodGVK  = corev1.SchemeGroupVersion.WithKind("Pod")
	NodeGVK = corev1.SchemeGroupVersion.WithKind("Node")

	PodGVR     = corev1.SchemeGroupVersion.WithResource("pods")
	NodeGVR    = corev1.SchemeGroupVersion.WithResource("nodes")
	SecretGVR  = corev1.SchemeGroupVersion.WithResource("secret")
	ClusterGVR = clusterv1alpha1.SchemeGroupVersion.WithResource("cluster")

	PodSelector  = searchv1alpha1.ResourceSelector{APIVersion: PodGVK.GroupVersion().String(), Kind: PodGVK.Kind}
	NodeSelector = searchv1alpha1.ResourceSelector{APIVersion: NodeGVK.GroupVersion().String(), Kind: NodeGVK.Kind}

	RestMapper *meta.DefaultRESTMapper
)

variables for test

Functions

func ErrorMessageEquals

func ErrorMessageEquals(a, b error) bool

ErrorMessageEquals compare if two error message is equal. 1. nil error == nil error 2. nil error != non nil error 3. Other wise compare error.Error() returned string

Types

type MockStore

type MockStore struct {
	UpdateCacheFunc          func(resourcesByCluster map[string]map[schema.GroupVersionResource]*store.MultiNamespace) error
	HasResourceFunc          func(resource schema.GroupVersionResource) bool
	GetResourceFromCacheFunc func(ctx context.Context, gvr schema.GroupVersionResource, namespace, name string) (runtime.Object, string, error)
	StopFunc                 func()
	GetFunc                  func(ctx context.Context, gvr schema.GroupVersionResource, name string, options *metav1.GetOptions) (runtime.Object, error)
	ListFunc                 func(ctx context.Context, gvr schema.GroupVersionResource, options *metainternalversion.ListOptions) (runtime.Object, error)
	WatchFunc                func(ctx context.Context, gvr schema.GroupVersionResource, options *metainternalversion.ListOptions) (watch.Interface, error)
}

MockStore is a mock for store.Store interface

func (*MockStore) Get

Get implements store.Store interface

func (*MockStore) GetResourceFromCache

func (c *MockStore) GetResourceFromCache(ctx context.Context, gvr schema.GroupVersionResource, namespace, name string) (runtime.Object, string, error)

GetResourceFromCache implements store.Store interface

func (*MockStore) HasResource

func (c *MockStore) HasResource(resource schema.GroupVersionResource) bool

HasResource implements store.Store interface

func (*MockStore) List

List implements store.Store interface

func (*MockStore) Stop

func (c *MockStore) Stop()

Stop implements store.Store interface

func (*MockStore) UpdateCache

func (c *MockStore) UpdateCache(resourcesByCluster map[string]map[schema.GroupVersionResource]*store.MultiNamespace) error

UpdateCache implements store.Store interface

func (*MockStore) Watch

Watch implements store.Store interface

Jump to

Keyboard shortcuts

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