Documentation ¶
Index ¶
- Constants
- Variables
- func CrainaDescribe(text string, body func()) bool
- func CreateKubeNamespace(baseName string, c kubernetes.Interface) (string, error)
- func DeleteKubeNamespace(c kubernetes.Interface, namespace string) error
- func ExpectConsistOf(actual interface{}, extra interface{}, explain ...interface{})
- func ExpectEmpty(actual interface{}, explain ...interface{})
- func ExpectEqual(actual interface{}, extra interface{}, explain ...interface{})
- func ExpectError(err error, explain ...interface{})
- func ExpectHaveKey(actual interface{}, key interface{}, explain ...interface{})
- func ExpectNotEqual(actual interface{}, extra interface{}, explain ...interface{})
- func Failf(format string, args ...interface{})
- func GetConfig() (*rest.Config, error)
- func GetConfigOrDie() *rest.Config
- func Logf(format string, args ...interface{})
- func PatchPvcWithRetries(c kubernetes.Interface, namespace, name, patchStr string) error
- func RegisterParseFlags()
- type Framework
- func (f *Framework) AfterEach()
- func (f *Framework) BeforeEach()
- func (f *Framework) CreateEnvironment()
- func (f *Framework) DeletePod(ns, name string) error
- func (f *Framework) DeletePvc(name, namespace string) error
- func (f *Framework) DeleteStorageClass(storageClassName string)
- func (f *Framework) DestroyEnvironment()
- func (f *Framework) EnsurDeployment(deploy *appsv1.Deployment, selector string) *appsv1.Deployment
- func (f *Framework) EnsurePvc(pvc *corev1.PersistentVolumeClaim) *corev1.PersistentVolumeClaim
- func (f *Framework) GetDeployment(namespace string, name string) *appsv1.Deployment
- func (f *Framework) GetPods(ns, labelSelector string) (pods *v1.PodList)
- func (f *Framework) GetPvc(namespace string, name string) *corev1.PersistentVolumeClaim
- func (f *Framework) Kubectl(args ...string) ([]byte, []byte, error)
- func (f *Framework) KubectlWithInput(input []byte, args ...string) ([]byte, []byte, error)
- func (f *Framework) NewStorageClass(s *storagev1.StorageClass)
- func (f *Framework) PatchPvc(namespace, name, patchStr string) *corev1.PersistentVolumeClaim
- func (f *Framework) UpdatePvc(pvc *corev1.PersistentVolumeClaim) *corev1.PersistentVolumeClaim
- func (f *Framework) WaitForPod(selector string, timeout time.Duration, shouldFail bool)
- type Suite
- type TestContextType
Constants ¶
const ( // E2E represents a test suite for e2e. E2E Suite = "e2e" // NodeE2E represents a test suite for node e2e. NodeE2E Suite = "node e2e" // Poll how often to poll for conditions Poll = 2 * time.Second // DefaultTimeout time to wait for operations to complete DefaultTimeout = 90 * time.Second )
Variables ¶
var (
// KubectlPath defines the full path of the kubectl binary
KubectlPath = "/usr/local/bin/kubectl"
)
var RunID = uuid.NewUUID()
RunID unique identifier of the e2e run
Functions ¶
func CrainaDescribe ¶
Craina wrapper function for ginkgo describe. Adds namespacing.
func CreateKubeNamespace ¶
func CreateKubeNamespace(baseName string, c kubernetes.Interface) (string, error)
CreateKubeNamespace creates a new namespace in the cluster
func DeleteKubeNamespace ¶
func DeleteKubeNamespace(c kubernetes.Interface, namespace string) error
DeleteKubeNamespace deletes a namespace and all the objects inside
func ExpectConsistOf ¶
func ExpectConsistOf(actual interface{}, extra interface{}, explain ...interface{})
ExpectConsistOf expects actual contains precisely the extra elements. The ordering of the elements does not matter.
func ExpectEmpty ¶
func ExpectEmpty(actual interface{}, explain ...interface{})
ExpectEmpty expects actual is empty
func ExpectEqual ¶
func ExpectEqual(actual interface{}, extra interface{}, explain ...interface{})
ExpectEqual expects the specified two are the same, otherwise an exception raises
func ExpectError ¶
func ExpectError(err error, explain ...interface{})
ExpectError expects an error happens, otherwise an exception raises
func ExpectHaveKey ¶
func ExpectHaveKey(actual interface{}, key interface{}, explain ...interface{})
ExpectHaveKey expects the actual map has the key in the keyset
func ExpectNotEqual ¶
func ExpectNotEqual(actual interface{}, extra interface{}, explain ...interface{})
ExpectNotEqual expects the specified two are not the same, otherwise an exception raises
func Failf ¶
func Failf(format string, args ...interface{})
Failf logs to the INFO logs and fails the test.
func GetConfig ¶
GetConfig creates a *rest.Config for talking to a Kubernetes API server. If --kubeconfig is set, will use the kubeconfig file at that location. Otherwise will assume running in cluster and use the cluster provided kubeconfig.
It also applies saner defaults for QPS and burst based on the Kubernetes controller manager defaults (20 QPS, 30 burst)
Config precedence ¶
* --kubeconfig flag pointing at a file
* KUBECONFIG environment variable pointing at a file
* In-cluster config if running in cluster
* $HOME/.kube/config if exists
func GetConfigOrDie ¶
GetConfigOrDie creates a *rest.Config for talking to a Kubernetes apiserver. If --kubeconfig is set, will use the kubeconfig file at that location. Otherwise will assume running in cluster and use the cluster provided kubeconfig.
Will log an error and exit if there is an error creating the rest.Config.
func PatchPvcWithRetries ¶
func PatchPvcWithRetries(c kubernetes.Interface, namespace, name, patchStr string) error
func RegisterParseFlags ¶
func RegisterParseFlags()
RegisterParseFlags registers and parses flags for the test binary.
Types ¶
type Framework ¶
type Framework struct { BaseName string // A Kubernetes and Service Catalog client KubeClientSet kubernetes.Interface KubeConfig *restclient.Config APIExtensionsClientSet apiextcs.Interface Namespace string }
func NewDefaultFramework ¶
NewDefaultFramework makes a new framework and sets up a BeforeEach/AfterEach for you (you can write additional before/after each functions).
func NewSimpleFramework ¶
NewSimpleFramework makes a new framework that allows the usage of a namespace for arbitraty tests.
func (*Framework) AfterEach ¶
func (f *Framework) AfterEach()
AfterEach deletes the namespace, after reading its events.
func (*Framework) BeforeEach ¶
func (f *Framework) BeforeEach()
BeforeEach gets a client and makes a namespace.
func (*Framework) CreateEnvironment ¶
func (f *Framework) CreateEnvironment()
func (*Framework) DeleteStorageClass ¶
func (*Framework) DestroyEnvironment ¶
func (f *Framework) DestroyEnvironment()
func (*Framework) EnsurDeployment ¶
func (f *Framework) EnsurDeployment(deploy *appsv1.Deployment, selector string) *appsv1.Deployment
func (*Framework) EnsurePvc ¶
func (f *Framework) EnsurePvc(pvc *corev1.PersistentVolumeClaim) *corev1.PersistentVolumeClaim
EnsurePvc creates a pvc object and returns it, throws error if it already exists.
func (*Framework) GetDeployment ¶
func (f *Framework) GetDeployment(namespace string, name string) *appsv1.Deployment
func (*Framework) GetPvc ¶
func (f *Framework) GetPvc(namespace string, name string) *corev1.PersistentVolumeClaim
func (*Framework) KubectlWithInput ¶
func (*Framework) NewStorageClass ¶
func (f *Framework) NewStorageClass(s *storagev1.StorageClass)
func (*Framework) PatchPvc ¶
func (f *Framework) PatchPvc(namespace, name, patchStr string) *corev1.PersistentVolumeClaim
UpdatePvc updates a pvc object and returns the updated object.
func (*Framework) UpdatePvc ¶
func (f *Framework) UpdatePvc(pvc *corev1.PersistentVolumeClaim) *corev1.PersistentVolumeClaim
UpdatePvc updates a pvc object and returns the updated object.
type Suite ¶
type Suite string
Suite represents test suite.
var CurrentSuite Suite
CurrentSuite represents current test suite.
type TestContextType ¶
TestContextType describes the client context to use in communications with the Kubernetes API.
var TestContext TestContextType
TestContext is the global client context for tests.