utils

package
v0.0.0-...-9afe088 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2019 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEndpoints

func CheckEndpoints(t *testing.T, eps *corev1.Endpoints, wantedPod int) (bool, error)

CheckEndpoints check if the count of endpoint is the expexted one

func LabelsAsSelectorString

func LabelsAsSelectorString(lbs map[string]string) string

LabelsAsSelectorString albel map to label string

func NewDeployment

func NewDeployment(namespace, name, image, tag string, command []string, replicas int32) *appsv1.Deployment

NewDeployment create a new deployment

func NewKanaryDeployment

func NewKanaryDeployment(namespace, name, deploymentName, serviceName, image, tag string, command []string, replicas int32, scale *kanaryv1alpha1.KanaryDeploymentSpecScale, traffic *kanaryv1alpha1.KanaryDeploymentSpecTraffic, validation *kanaryv1alpha1.KanaryDeploymentSpecValidationList) *kanaryv1alpha1.KanaryDeployment

NewKanaryDeployment create a new Kanary Deployments CR

func NewService

func NewService(namespace, name string, labelsSelector map[string]string) *corev1.Service

NewService create a new service

func RandValueIn

func RandValueIn(base int, delta int) float64

RandValueIn return a random value +/- delta around the base

func SanitizeLabel

func SanitizeLabel(label string) string

SanitizeLabel sanitize a kubernetes label to be used as prometheus label

func UpdateDeploymentFunc

func UpdateDeploymentFunc(f *framework.Framework, name, namespace string, updateFunc func(kd *appsv1.Deployment)) error

UpdateDeploymentFunc update the deployment using the updateFunc

func UpdateKanaryDeploymentFunc

func UpdateKanaryDeploymentFunc(f *framework.Framework, namespace, name string, updateFunc func(kd *kanaryv1alpha1.KanaryDeployment), retryInterval, timeout time.Duration) error

UpdateKanaryDeploymentFunc used to update a KanaryDeployment with retry and timeout policy

func WaitForEndpointsCount

func WaitForEndpointsCount(t *testing.T, kubeclient kubernetes.Interface, namespace, name string, endpointCount int, retryInterval, timeout time.Duration) error

WaitForEndpointsCount wait for the endpoint to reach a given count

func WaitForFuncOnDeployment

func WaitForFuncOnDeployment(t *testing.T, kubeclient kubernetes.Interface, namespace, name string, f func(dep *appsv1beta1.Deployment) (bool, error), retryInterval, timeout time.Duration) error

WaitForFuncOnDeployment used to wait a valid condition on a Deployment

func WaitForFuncOnEndpoints

func WaitForFuncOnEndpoints(t *testing.T, kubeclient kubernetes.Interface, namespace, name string, f EndpointCheckFunc, retryInterval, timeout time.Duration) error

WaitForFuncOnEndpoints used to wait a valid condition on Endpoints

func WaitForFuncOnHPA

func WaitForFuncOnHPA(t *testing.T, kubeclient kubernetes.Interface, namespace, name string, f func(hpa *v2beta1.HorizontalPodAutoscaler) (bool, error), retryInterval, timeout time.Duration) error

WaitForFuncOnHPA used to wait a valid condition on a HPA

func WaitForFuncOnKanaryDeployment

func WaitForFuncOnKanaryDeployment(t *testing.T, client framework.FrameworkClient, namespace, name string, f func(kd *kanaryv1alpha1.KanaryDeployment) (bool, error), retryInterval, timeout time.Duration) error

WaitForFuncOnKanaryDeployment used to wait a valid condition on a KanaryDeployment

func WaitForInvalidStatusOnKanaryDeployment

func WaitForInvalidStatusOnKanaryDeployment(t *testing.T, client framework.FrameworkClient, namespace, name string, retryInterval, timeout time.Duration) error

WaitForInvalidStatusOnKanaryDeployment used to wait an invalidated status on a KanaryDeployment

Types

type EndpointCheckFunc

type EndpointCheckFunc func(*corev1.Endpoints) (bool, error)

EndpointCheckFunc function to perform checks on endpoint object

type PromTestHelper

type PromTestHelper struct {
	// contains filtered or unexported fields
}

PromTestHelper struct helps to create a Prometheus pod that rune a prom server and a push gateway

func NewPromTestHelper

func NewPromTestHelper(t *testing.T, ctx *framework.TestCtx, f *framework.Framework, jobName string, collectors []prometheus.Collector) *PromTestHelper

NewPromTestHelper contructor for PromTestHelper

func (*PromTestHelper) Run

func (p *PromTestHelper) Run()

Run deploy the prometheus pod (server+pushgateway) and associated service

func (*PromTestHelper) StopPushGateway

func (p *PromTestHelper) StopPushGateway()

StopPushGateway terminates on going metric push

Jump to

Keyboard shortcuts

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