kubernetes: k8s.io/kubernetes/test/integration/etcd Index | Files

package etcd

import "k8s.io/kubernetes/test/integration/etcd"

Index

Package Files

data.go server.go

func CrdExistsInDiscovery Uses

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 Uses

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 Uses

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 Uses

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 GetEtcdStorageDataForNamespace Uses

func GetEtcdStorageDataForNamespace(namespace string) map[schema.GroupVersionResource]StorageData

GetEtcdStorageDataForNamespace 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. Namespaced objects keys are computed for the specified namespace.

func JSONToUnstructured Uses

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

type Master Uses

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 Uses

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 Uses

type Prerequisite struct {
    GvrData schema.GroupVersionResource
    Stub    string
}

Prerequisite contains information required to create a resource (but not verify it)

type Resource Uses

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 Uses

func GetResources(t *testing.T, serverResources []*metav1.APIResourceList) []Resource

GetResources fetches the Resources associated with serverResources that support get and create

type StorageData Uses

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

Package etcd imports 33 packages (graph) and is imported by 9 packages. Updated 2019-11-17. Refresh now. Tools for package owners.