Documentation ¶
Index ¶
- func CrdExistsInDiscovery(client apiextensionsclientset.Interface, ...) bool
- func CreateTestCRDs(t *testing.T, client apiextensionsclientset.Interface, ...)
- func GetCustomResourceDefinitionData() []*apiextensionsv1beta1.CustomResourceDefinition
- func GetEtcdStorageData() map[schema.GroupVersionResource]StorageData
- func JSONToUnstructured(stub, namespace string, mapping *meta.RESTMapping, ...) (dynamic.ResourceInterface, *unstructured.Unstructured, error)
- type Master
- type Prerequisite
- type Resource
- type StorageData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CrdExistsInDiscovery ¶
func CrdExistsInDiscovery(client apiextensionsclientset.Interface, crd *apiextensionsv1beta1.CustomResourceDefinition) bool
CrdExistsInDiscovery checks to see if the given CRD exists in discovery at all served versions.
func CreateTestCRDs ¶
func CreateTestCRDs(t *testing.T, client apiextensionsclientset.Interface, skipCrdExistsInDiscovery bool, crds ...*apiextensionsv1beta1.CustomResourceDefinition)
CreateTestCRDs creates the given CRDs, any failure causes the test to Fatal. If skipCrdExistsInDiscovery is true, the CRDs are only checked for the Established condition via their Status. If skipCrdExistsInDiscovery is false, the CRDs are checked via discovery, see CrdExistsInDiscovery.
func GetCustomResourceDefinitionData ¶
func GetCustomResourceDefinitionData() []*apiextensionsv1beta1.CustomResourceDefinition
GetCustomResourceDefinitionData returns the resource definitions that back the custom resources included in GetEtcdStorageData. They should be created using CreateTestCRDs before running any tests.
func GetEtcdStorageData ¶
func GetEtcdStorageData() map[schema.GroupVersionResource]StorageData
GetEtcdStorageData returns etcd data for all persisted objects. It is exported so that it can be reused across multiple tests. It returns a new map on every invocation to prevent different tests from mutating shared state.
func JSONToUnstructured ¶
func JSONToUnstructured(stub, namespace string, mapping *meta.RESTMapping, dynamicClient dynamic.Interface) (dynamic.ResourceInterface, *unstructured.Unstructured, error)
JSONToUnstructured converts a JSON stub to unstructured.Unstructured and returns a dynamic resource client that can be used to interact with it
Types ¶
type Master ¶
type Master struct { Client clientset.Interface Dynamic dynamic.Interface Config *restclient.Config KV clientv3.KV Mapper meta.RESTMapper Resources []Resource Cleanup func() }
Master represents a running API server that is ready for use The Cleanup func must be deferred to prevent resource leaks
func StartRealMasterOrDie ¶
func StartRealMasterOrDie(t *testing.T, configFuncs ...func(*options.ServerRunOptions)) *Master
StartRealMasterOrDie starts an API master that is appropriate for use in tests that require one of every resource
type Prerequisite ¶
type Prerequisite struct { GvrData schema.GroupVersionResource Stub string }
Prerequisite contains information required to create a resource (but not verify it)
type Resource ¶
type Resource struct { Mapping *meta.RESTMapping HasDeleteCollection bool }
Resource contains REST mapping information for a specific resource and extra metadata such as delete collection support
func GetResources ¶
func GetResources(t *testing.T, serverResources []*metav1.APIResourceList) []Resource
GetResources fetches the Resources associated with serverResources that support get and create
type StorageData ¶
type StorageData struct { Stub string // Valid JSON stub to use during create Prerequisites []Prerequisite // Optional, ordered list of JSON objects to create before stub ExpectedEtcdPath string // Expected location of object in etcd, do not use any variables, constants, etc to derive this value - always supply the full raw string ExpectedGVK *schema.GroupVersionKind // The GVK that we expect this object to be stored as - leave this nil to use the default }
StorageData contains information required to create an object and verify its storage in etcd It must be paired with a specific resource