etcd

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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) *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

Jump to

Keyboard shortcuts

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