framework

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Copyright 2014 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// Poll how often to poll for conditions
	Poll = 2 * time.Second

	// DefaultTimeout time to wait for operations to complete
	DefaultTimeout = 90 * time.Second
)

Variables

View Source
var (
	// KubectlPath defines the full path of the kubectl binary
	KubectlPath = "/usr/local/bin/kubectl"
)
View Source
var RunID = uuid.NewUUID()

RunID unique identifier of the e2e run

Functions

func CreateKubeNamespace

func CreateKubeNamespace(baseName string, c kubernetes.Interface) (string, error)

CreateKubeNamespace creates a new namespace in the cluster

func CreateNamespace

func CreateNamespace(name string, c kubernetes.Interface) (string, error)

CreateNamespace 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 Logs

func Logs(pod *corev1.Pod) (string, error)

Logs returns the log entries of a given Pod.

func WaitForEndpoints

func WaitForEndpoints(kubeClientSet kubernetes.Interface, timeout time.Duration, name, ns string, expectedEndpoints int) error

WaitForEndpoints waits for a given amount of time until an endpoint contains.

func WaitForKubeNamespaceNotExist

func WaitForKubeNamespaceNotExist(c kubernetes.Interface, namespace string) error

WaitForKubeNamespaceNotExist waits until a namespaces is not present in the cluster

func WaitForPodsDeleted

func WaitForPodsDeleted(kubeClientSet kubernetes.Interface, timeout time.Duration, namespace string, opts metav1.ListOptions) error

WaitForPodsDeleted waits for a given amount of time until a group of Pods are deleted in the given namespace.

func WaitForPodsReady

func WaitForPodsReady(kubeClientSet kubernetes.Interface, timeout time.Duration, expectedReplicas int, namespace string, opts metav1.ListOptions) error

WaitForPodsReady waits for a given amount of time until a group of Pods is running in the given namespace.

func WaitForSecret

func WaitForSecret(kubeClientSet kubernetes.Interface, timeout time.Duration, name, ns string, expected map[string]string) error

WaitForSecret waits for a given amount of time until a secret exists

Types

type FakeHarbor

type FakeHarbor struct {
	URL string
}

FakeHarbor ..

func (*FakeHarbor) EnsureUpdate

func (f *FakeHarbor) EnsureUpdate(namespace string, info harbor.SystemInfoResponse, projects []harbor.Project, robots map[string][]harbor.Robot)

EnsureUpdate ..

type Framework

type Framework struct {
	BaseName string

	// A Kubernetes and Service Catalog client
	KubeClientSet          kubernetes.Interface
	KubeConfig             *restclient.Config
	APIExtensionsClientSet apiextcs.Interface

	Harbor *FakeHarbor

	Namespace string
}

Framework supports common operations used by e2e tests; it will keep a client & a namespace for you.

func NewDefaultFramework

func NewDefaultFramework(baseName string) *Framework

NewDefaultFramework makes a new framework and sets up a BeforeEach/AfterEach for you (you can write additional before/after each functions).

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

func (f *Framework) EnsureConfigMap(configMap *api.ConfigMap) (*api.ConfigMap, error)

EnsureConfigMap creates a ConfigMap object or returns it if it already exists.

func (*Framework) EnsureDeployment

func (f *Framework) EnsureDeployment(deployment *appsv1.Deployment) *appsv1.Deployment

EnsureDeployment creates a Deployment object and retunrs it, throws error if it already exists.

func (*Framework) EnsureSecret

func (f *Framework) EnsureSecret(secret *api.Secret) *api.Secret

EnsureSecret creates a Secret object or returns it if it already exists.

func (*Framework) EnsureService

func (f *Framework) EnsureService(service *core.Service) *core.Service

EnsureService creates a Service object and retunrs it, throws error if it already exists.

Jump to

Keyboard shortcuts

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