kubetest

package
v0.0.0-...-53791e0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 67 Imported by: 0

Documentation

Overview

Package kubetest provides API for writing Kubernetes specific tests

Index

Constants

View Source
const (
	// PodStartTimeout - Default pod startup time
	PodStartTimeout = 3 * time.Minute

	//NetworkPluginCNIFailure - pattern to check for CNI issue, pattern required to try redeploy pod
	NetworkPluginCNIFailure = "NetworkPlugin cni failed to set up pod"
)

Variables

This section is empty.

Functions

func CollectXcons

func CollectXcons(ch <-chan *crossconnect.CrossConnectEvent,
	n int, timeout time.Duration) (map[string]*crossconnect.CrossConnect, error)

CollectXcons takes n crossconencts from event channel

func CreateAdmissionWebhookDeployment

func CreateAdmissionWebhookDeployment(k8s *K8s, name, image, namespace string) *appsv1.Deployment

CreateAdmissionWebhookDeployment - Setup Admission Webhook deoloyment

func CreateAdmissionWebhookSecret

func CreateAdmissionWebhookSecret(k8s *K8s, name, namespace string) (*v1.Secret, tls.Certificate)

CreateAdmissionWebhookSecret - Create admission webhook secret

func CreateAdmissionWebhookService

func CreateAdmissionWebhookService(k8s *K8s, name, namespace string) *v1.Service

CreateAdmissionWebhookService - Create Admission Webhook Service

func CreateCrossConnectMonitorDeployment

func CreateCrossConnectMonitorDeployment(k8s *K8s, image string) *appsv1.Deployment

CreateCrossConnectMonitorDeployment creates crossconnect-monitor deployment

func CreateCrossConnectMonitorService

func CreateCrossConnectMonitorService(k8s *K8s) *v1.Service

CreateCrossConnectMonitorService creates crossconnect-monitor service

func CreateMutatingWebhookConfiguration

func CreateMutatingWebhookConfiguration(k8s *K8s, c tls.Certificate, name, namespace string) *arv1beta1.MutatingWebhookConfiguration

CreateMutatingWebhookConfiguration - Setup Mutating webhook configuration

func CreatePrometheusClusterRoles

func CreatePrometheusClusterRoles(k8s *K8s) []nsmrbac.Role

CreatePrometheusClusterRoles creates prometheus roles

func CreatePrometheusConfigMap

func CreatePrometheusConfigMap(k8s *K8s) *v1.ConfigMap

CreatePrometheusConfigMap creates prometheus configMap

func CreatePrometheusDeployment

func CreatePrometheusDeployment(k8s *K8s) *appsv1.Deployment

CreatePrometheusDeployment creates prometheus deployment

func CreatePrometheusService

func CreatePrometheusService(k8s *K8s) *v1.Service

CreatePrometheusService creates prometheus service

func CrossConnectClientAt

func CrossConnectClientAt(k8s *K8s, pod *v1.Pod) (<-chan *crossconnect.CrossConnectEvent, func())

CrossConnectClientAt returns channel of CrossConnectEvents from passed nsmgr pod

func DefaultForwarderVariables

func DefaultForwarderVariables(plane string) map[string]string

DefaultForwarderVariables - Default variables for forwarder deployment

func DefaultPlaneVariablesKernel

func DefaultPlaneVariablesKernel() map[string]string

DefaultPlaneVariablesKernel - Default variables for Kernel forwarding deployment

func DefaultPlaneVariablesVPP

func DefaultPlaneVariablesVPP() map[string]string

DefaultPlaneVariablesVPP - Default variables for VPP deployment

func DeleteAdmissionWebhook

func DeleteAdmissionWebhook(k8s *K8s, secretName string,
	awc *arv1beta1.MutatingWebhookConfiguration, awDeployment *appsv1.Deployment, awService *v1.Service, namespace string)

DeleteAdmissionWebhook - Delete admission webhook

func DeleteCrossConnectMonitor

func DeleteCrossConnectMonitor(k8s *K8s, depl *appsv1.Deployment, svc *v1.Service)

DeleteCrossConnectMonitor deletes crossconnect-monitor deployment

func DeletePrometheus

func DeletePrometheus(k8s *K8s, roles []nsmrbac.Role, depl *appsv1.Deployment, svc *v1.Service)

DeletePrometheus deletes prometheus roles, configMap, deployment and service

func DeployAdmissionWebhook

func DeployAdmissionWebhook(k8s *K8s, name, image, namespace string, timeout time.Duration) (*arv1beta1.MutatingWebhookConfiguration, *appsv1.Deployment, *v1.Service)

DeployAdmissionWebhook - Setup Admission Webhook

func DeployCorefile

func DeployCorefile(k8s *K8s, name, content string) error

DeployCorefile - Creates configmap with Corefile content

func DeployCrossConnectMonitor

func DeployCrossConnectMonitor(k8s *K8s, image string) (*appsv1.Deployment, *v1.Service)

DeployCrossConnectMonitor deploys crossconnect-monitor

func DeployDirtyICMP

func DeployDirtyICMP(k8s *K8s, node *v1.Node, name string, timeout time.Duration) *v1.Pod

DeployDirtyICMP deploys 'icmp-responder-nse' pod with '-dirty' flag set

func DeployICMP

func DeployICMP(k8s *K8s, node *v1.Node, name string, timeout time.Duration) *v1.Pod

DeployICMP deploys 'icmp-responder-nse' pod with '-routes' flag set

func DeployICMPAndCoredns

func DeployICMPAndCoredns(k8s *K8s, node *v1.Node, name, corednsConfigName string, timeout time.Duration) *v1.Pod

DeployICMPAndCoredns deploys 'icmp-responder-nse' pod with '-routes', '-dns' flag set. Also injected coredns server.

func DeployICMPWithConfig

func DeployICMPWithConfig(k8s *K8s, node *v1.Node, name string, timeout time.Duration, gracePeriod int64) *v1.Pod

DeployICMPWithConfig deploys 'icmp-responder-nse' pod with '-routes' flag set and given grace period

func DeployMonitoringNSC

func DeployMonitoringNSC(k8s *K8s, node *v1.Node, name string, timeout time.Duration) *v1.Pod

DeployMonitoringNSC deploys 'monitoring-nsc' pod

func DeployMonitoringNSCAndCoredns

func DeployMonitoringNSCAndCoredns(k8s *K8s, node *v1.Node, name string, timeout time.Duration) *v1.Pod

DeployMonitoringNSCAndCoredns deploys pod of nsm-dns-monitoring-nsc and coredns

func DeployNSC

func DeployNSC(k8s *K8s, node *v1.Node, name string, timeout time.Duration) *v1.Pod

DeployNSC - Setup Default Client

func DeployNSCMonitor

func DeployNSCMonitor(k8s *K8s, node *v1.Node, name string, timeout time.Duration) *v1.Pod

DeployNSCMonitor - Setup Default Client

func DeployNSCWebhook

func DeployNSCWebhook(k8s *K8s, node *v1.Node, name string, timeout time.Duration) *v1.Pod

DeployNSCWebhook - Setup Default Client with webhook

func DeployNSCWithEnv

func DeployNSCWithEnv(k8s *K8s, node *v1.Node, name string, timeout time.Duration, env map[string]string) *v1.Pod

DeployNSCWithEnv - Setup Default Client with custom environment

func DeployNSMRS

func DeployNSMRS(k8s *K8s, node *v1.Node, name string, timeout time.Duration) *v1.Pod

DeployNSMRS - Setup NSMRS on Cluster with default config

func DeployNSMRSWithConfig

func DeployNSMRSWithConfig(k8s *K8s, node *v1.Node, name string, timeout time.Duration, config *pods.NSMgrPodConfig) *v1.Pod

DeployNSMRSWithConfig - Setup NSMRS on Cluster

func DeployNeighborNSE

func DeployNeighborNSE(k8s *K8s, node *v1.Node, name string, timeout time.Duration) *v1.Pod

DeployNeighborNSE deploys 'icmp-responder-nse' pod with '-neighbors' flag set

func DeployNscAndNsmCoredns

func DeployNscAndNsmCoredns(k8s *K8s, node *v1.Node, name, corefileName string, timeout time.Duration) *v1.Pod

DeployNscAndNsmCoredns deploys pod of default client and coredns

func DeployPrometheus

func DeployPrometheus(k8s *K8s) ([]nsmrbac.Role, *appsv1.Deployment, *v1.Service)

DeployPrometheus deploys prometheus roles, configMap, deployment and service

func DeployProxyNSMgr

func DeployProxyNSMgr(k8s *K8s, node *v1.Node, name string, timeout time.Duration) (pnsmd *v1.Pod, err error)

DeployProxyNSMgr - Setup Proxy NSMgr on Cluster

func DeployProxyNSMgrWithConfig

func DeployProxyNSMgrWithConfig(k8s *K8s, node *v1.Node, name string, timeout time.Duration, config *pods.NSMgrPodConfig) (pnsmd *v1.Pod, err error)

DeployProxyNSMgrWithConfig - Setup Proxy NSMgr on Cluster with custom config

func DeployUpdatingNSE

func DeployUpdatingNSE(k8s *K8s, node *v1.Node, name string, timeout time.Duration) *v1.Pod

DeployUpdatingNSE deploys 'icmp-responder-nse' pod with '-update' flag set

func DeployVppAgentICMP

func DeployVppAgentICMP(k8s *K8s, node *v1.Node, name string, timeout time.Duration) *v1.Pod

DeployVppAgentICMP - Setup VPP Agent based ICMP responder NSE

func DeployVppAgentNSC

func DeployVppAgentNSC(k8s *K8s, node *v1.Node, name string, timeout time.Duration) *v1.Pod

DeployVppAgentNSC - Setup Default VPP Based Client

func ExpectNSEsCountToBe

func ExpectNSEsCountToBe(k8s *K8s, countWas, countExpected int)

ExpectNSEsCountToBe checks if nses count becomes 'countExpected' after a time

func ExpectNSMsCountToBe

func ExpectNSMsCountToBe(k8s *K8s, countWas, countExpected int)

ExpectNSMsCountToBe checks if nsms count becomes 'countExpected' after a time

func FindJaegerPod

func FindJaegerPod(k8s *K8s) *v1.Pod

FindJaegerPod returns jaeger pod or nil

func GetJaegerTraces

func GetJaegerTraces(k8s *K8s, jaegerPod *v1.Pod) map[string]string

GetJaegerTraces rerturns map of service and traces

func GetNodeExternalIP

func GetNodeExternalIP(node *v1.Node) (string, error)

GetNodeExternalIP - Pop InternalIP from node addresses

func GetNodeInternalIP

func GetNodeInternalIP(node *v1.Node) (string, error)

GetNodeInternalIP - Pop InternalIP from node addresses

func GetVppAgentNSEAddr

func GetVppAgentNSEAddr(k8s *K8s, nsc *v1.Pod) (net.IP, error)

GetVppAgentNSEAddr - GetVppAgentNSEAddr - Return vpp agent NSE address

func InitSpireSecurity

func InitSpireSecurity(k8s *K8s) func()

InitSpireSecurity deploys pod that proxy Spire certificates to test environment

func IsBrokeTestsEnabled

func IsBrokeTestsEnabled() bool

IsBrokeTestsEnabled - Check if broken tests are enabled

func IsNsePinged

func IsNsePinged(k8s *K8s, from *v1.Pod) (result bool)

IsNsePinged - Checks if the interface to NSE exists and NSE is pinged

func IsVppAgentNsePinged

func IsVppAgentNsePinged(k8s *K8s, from *v1.Pod) (result bool)

IsVppAgentNsePinged - Check if vpp agent NSE is pinged

func NSLookup

func NSLookup(k8s *K8s, pod *v1.Pod, hostname string) bool

NSLookup invokes nslookup on pod with concrete hostname. Tries several times

func NewEventChecker

func NewEventChecker(t *testing.T, actualCh <-chan *crossconnect.CrossConnectEvent) (expectedFunc func(EventChecker), waitFunc func())

NewEventChecker starts goroutine that read events from actualCh and compare it with SingleEventChecker passed to expectedFunc

func NewJaegerTracesFinder

func NewJaegerTracesFinder(k8s *K8s) artifacts.Finder

NewJaegerTracesFinder creates jaeger artifacts finder

func NewK8sLogFinder

func NewK8sLogFinder(k8s *K8s) artifacts.Finder

NewK8sLogFinder creates finder for pods logs

func NoHealNSMgrPodConfig

func NoHealNSMgrPodConfig(k8s *K8s) []*pods.NSMgrPodConfig

NoHealNSMgrPodConfig returns config for NSMgr. The config has properties for disabling healing for nse

func PingByHostName

func PingByHostName(k8s *K8s, pod *v1.Pod, hostname string) bool

PingByHostName tries ping hostname from the first container of pod

func PrepareRegistryClients

func PrepareRegistryClients(k8s *K8s, nsmd *v1.Pod) (registry.NetworkServiceRegistryClient, registry.NsmRegistryClient, func())

PrepareRegistryClients prepare nse and nsm registry clients

func RunProxyNSMgrService

func RunProxyNSMgrService(k8s *K8s) func()

RunProxyNSMgrService deploys proxy NSMgr service to access proxy NSMgr pods with single DNS name

func ServiceRegistryAt

func ServiceRegistryAt(k8s *K8s, nsmgr *v1.Pod) (serviceregistry.ServiceRegistry, func())

ServiceRegistryAt creates new service registry on 5000 port

func UseIPv6

func UseIPv6() bool

UseIPv6 returns which IP version is going to be used in testing

func WaitNSMgrDeployed

func WaitNSMgrDeployed(k8s *K8s, nsmd *v1.Pod, timeout time.Duration)

WaitNSMgrDeployed - wait for NSMgr pod to be fully deployed.

func XconToString

func XconToString(xcon *crossconnect.CrossConnect) string

XconToString converts CrossConnect to string

Types

type EventChecker

type EventChecker interface {
	Check(eventCh <-chan *crossconnect.CrossConnectEvent) error
}

EventChecker abstracts checker of particular events from channel

type ExtK8s

type ExtK8s struct {
	K8s        *K8s
	NodesSetup []*NodeConf
}

ExtK8s - K8s ClientSet with nodes config

type K8s

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

func NewK8s

func NewK8s(g *WithT, prepare bool) (*K8s, error)

NewK8s - Creates a new K8s Clientset with roles for the default config

func NewK8sForConfig

func NewK8sForConfig(g *WithT, prepare bool, kubeconfig string) (*K8s, error)

NewK8sForConfig - Creates a new K8s Clientset for the given config with creating roles

func NewK8sWithClientset

func NewK8sWithClientset(clientset kubernetes.Interface, namespace string) *K8s

NewK8sWithClientset creates a k8s with injected API client

func NewK8sWithoutRoles

func NewK8sWithoutRoles(g *WithT, prepare bool) (*K8s, error)

NewK8sWithoutRoles - Creates a new K8s Clientset for the default config

func NewK8sWithoutRolesForConfig

func NewK8sWithoutRolesForConfig(g *WithT, prepare bool, kubeconfigPath string) (*K8s, error)

NewK8sWithoutRolesForConfig - Creates a new K8s Clientset for the given config

func (*K8s) Cleanup

func (k8s *K8s) Cleanup()

Cleanup cleans up

func (*K8s) CleanupCRDs

func (k8s *K8s) CleanupCRDs()

CleanupCRDs cleans up CRDs

func (*K8s) CleanupConfigMaps

func (k8s *K8s) CleanupConfigMaps()

CleanupConfigMaps cleans a configmap

func (*K8s) CleanupDeployments

func (k8s *K8s) CleanupDeployments()

CleanupDeployments cleans up deployment

func (*K8s) CleanupEndpointsCRDs

func (k8s *K8s) CleanupEndpointsCRDs()

CleanupEndpointsCRDs clean Network Service Endpoints from registry

func (*K8s) CleanupMutatingWebhookConfigurations

func (k8s *K8s) CleanupMutatingWebhookConfigurations()

CleanupMutatingWebhookConfigurations cleans mutating webhook with configuration

func (*K8s) CleanupSecrets

func (k8s *K8s) CleanupSecrets(secrets ...string)

CleanupSecrets cleans a secret

func (*K8s) CleanupServices

func (k8s *K8s) CleanupServices(services ...string)

CleanupServices cleans up services

func (*K8s) CreateConfigMap

func (k8s *K8s) CreateConfigMap(cm *v1.ConfigMap) (*v1.ConfigMap, error)

CreateConfigMap creates a configmap

func (*K8s) CreateDeployment

func (k8s *K8s) CreateDeployment(deployment *appsv1.Deployment, namespace string) (*appsv1.Deployment, error)

CreateDeployment creates deployment

func (*K8s) CreateMutatingWebhookConfiguration

func (k8s *K8s) CreateMutatingWebhookConfiguration(mutatingWebhookConf *arv1beta1.MutatingWebhookConfiguration) (*arv1beta1.MutatingWebhookConfiguration, error)

CreateMutatingWebhookConfiguration creates mutating webhook with configuration

func (*K8s) CreatePod

func (k8s *K8s) CreatePod(template *v1.Pod) *v1.Pod

CreatePod creates a pod

func (*K8s) CreatePods

func (k8s *K8s) CreatePods(templates ...*v1.Pod) []*v1.Pod

CreatePods create pods

func (*K8s) CreatePodsRaw

func (k8s *K8s) CreatePodsRaw(timeout time.Duration, failTest bool, templates ...*v1.Pod) ([]*v1.Pod, error)

CreatePodsRaw create raw pods

func (*K8s) CreateRoles

func (k8s *K8s) CreateRoles(rolesList ...string) ([]nsmrbac.Role, error)

CreateRoles create roles

func (*K8s) CreateSecret

func (k8s *K8s) CreateSecret(secret *v1.Secret, namespace string) (*v1.Secret, error)

CreateSecret creates a secret

func (*K8s) CreateService

func (k8s *K8s) CreateService(service *v1.Service, namespace string) (*v1.Service, error)

CreateService creates a service

func (*K8s) CreateServiceAccounts

func (k8s *K8s) CreateServiceAccounts()

CreateServiceAccounts create service accounts with passed names

func (*K8s) CreateTestNamespace

func (k8s *K8s) CreateTestNamespace(namespace string) (string, error)

CreateTestNamespace creates a test namespace

func (*K8s) DeleteDeployment

func (k8s *K8s) DeleteDeployment(deployment *appsv1.Deployment, namespace string) error

DeleteDeployment deletes deployment

func (*K8s) DeleteMutatingWebhookConfiguration

func (k8s *K8s) DeleteMutatingWebhookConfiguration(mutatingWebhookConf *arv1beta1.MutatingWebhookConfiguration) error

DeleteMutatingWebhookConfiguration deletes mutating webhook with configuration

func (*K8s) DeleteNSEs

func (k8s *K8s) DeleteNSEs(names ...string) error

DeleteNSEs deletes 'nse' resources by names

func (*K8s) DeleteNetworkServices

func (k8s *K8s) DeleteNetworkServices(names ...string) error

DeleteNetworkServices deletes 'networkservice' resources by names

func (*K8s) DeletePods

func (k8s *K8s) DeletePods(pods ...*v1.Pod)

DeletePods delete pods

func (*K8s) DeletePodsByName

func (k8s *K8s) DeletePodsByName(noPods ...string)

DeletePodsByName deletes pod if a pod's name contains one of the given strings

func (*K8s) DeletePodsForce

func (k8s *K8s) DeletePodsForce(pods ...*v1.Pod)

DeletePodsForce delete pods forcefully

func (*K8s) DeleteRoles

func (k8s *K8s) DeleteRoles(rolesList []nsmrbac.Role) ([]nsmrbac.Role, error)

DeleteRoles delete roles

func (*K8s) DeleteSecret

func (k8s *K8s) DeleteSecret(name, namespace string) error

DeleteSecret deletes a secret

func (*K8s) DeleteService

func (k8s *K8s) DeleteService(service *v1.Service, namespace string) error

DeleteService deletes a service

func (*K8s) DeleteServiceAccounts

func (k8s *K8s) DeleteServiceAccounts() error

DeleteServiceAccounts deletes passed service accounts from cluster

func (*K8s) DeleteTestNamespace

func (k8s *K8s) DeleteTestNamespace(namespace string) error

DeleteTestNamespace deletes a test namespace

func (*K8s) DescribePod

func (k8s *K8s) DescribePod(pod *v1.Pod)

DescribePod describes a pod

func (*K8s) Exec

func (o *K8s) Exec(pod *v1.Pod, container string, command ...string) (string, string, error)

func (*K8s) GetClientSet

func (k8s *K8s) GetClientSet() (kubernetes.Interface, error)

GetClientSet returns a clientset

func (*K8s) GetConfig

func (k8s *K8s) GetConfig() *rest.Config

GetConfig returns config

func (*K8s) GetForwardingPlane

func (k8s *K8s) GetForwardingPlane() string

GetForwardingPlane gets which forwarding plane is going to be used in testing

func (*K8s) GetFullLogs

func (k8s *K8s) GetFullLogs(pod *v1.Pod, container string, previous bool) (string, error)

GetFullLogs - return full logs

func (*K8s) GetK8sNamespace

func (k8s *K8s) GetK8sNamespace() string

GetK8sNamespace returns a namespace

func (*K8s) GetLogs

func (k8s *K8s) GetLogs(pod *v1.Pod, container string) (string, error)

GetLogs returns logs collected from pod::container

func (*K8s) GetLogsChannel

func (k8s *K8s) GetLogsChannel(ctx context.Context, pod *v1.Pod, options *v1.PodLogOptions) (chan string, chan error)

GetLogsChannel returns logs channel from pod with the given options

func (*K8s) GetLogsWithOptions

func (k8s *K8s) GetLogsWithOptions(pod *v1.Pod, options *v1.PodLogOptions) (string, error)

GetLogsWithOptions returns logs collected from pod with the given options

func (*K8s) GetNSEs

func (k8s *K8s) GetNSEs() ([]v1alpha1.NetworkServiceEndpoint, error)

GetNSEs returns existing 'nse' resources

func (*K8s) GetNSMList

func (k8s *K8s) GetNSMList() ([]v1alpha1.NetworkServiceManager, error)

GetNSMs returns existing 'nse' resources

func (*K8s) GetNamespace

func (k8s *K8s) GetNamespace(namespace string) (*v1.Namespace, error)

GetNamespace returns a namespace

func (*K8s) GetNetworkServices

func (k8s *K8s) GetNetworkServices() ([]v1alpha1.NetworkService, error)

GetNetworkServices returns existing 'networkservice' resources

func (*K8s) GetNodes

func (k8s *K8s) GetNodes() []v1.Node

GetNodes returns the nodes

func (*K8s) GetNodesWait

func (k8s *K8s) GetNodesWait(requiredNumber int, timeout time.Duration) []v1.Node

GetNodesWait wait for required number of nodes are up and running fine

func (*K8s) GetPod

func (k8s *K8s) GetPod(pod *v1.Pod) (*v1.Pod, error)

GetPod gets a pod

func (*K8s) GetPullingImagesDuration

func (k8s *K8s) GetPullingImagesDuration(pod *v1.Pod) time.Duration

GetPullingImagesDuration returns pod images pulling duration

func (*K8s) GetVersion

func (k8s *K8s) GetVersion() string

GetVersion returns the k8s version

func (*K8s) IsNetworkProblem

func (k8s *K8s) IsNetworkProblem(pod *v1.Pod) error

IsNetworkProblem - return error if pod has deploy network problems detected in events.

func (*K8s) IsPodReady

func (k8s *K8s) IsPodReady(pod *v1.Pod) bool

IsPodReady returns if a pod is ready

func (*K8s) ListPods

func (k8s *K8s) ListPods() ([]v1.Pod, error)

ListPods lists the pods

func (*K8s) ListPodsByNs

func (k8s *K8s) ListPodsByNs(ns string) []v1.Pod

ListPodsByNs returns pod list by specific namespace

func (*K8s) NewPortForwarder

func (k8s *K8s) NewPortForwarder(pod *v1.Pod, port int) (*PortForward, error)

func (*K8s) PrintImageVersion

func (k8s *K8s) PrintImageVersion(pod *v1.Pod)

PrintImageVersion Prints image version pf pod.

func (*K8s) SaveArtifacts

func (k8s *K8s) SaveArtifacts()

SaveArtifacts saves artifacts

func (*K8s) SaveTestArtifacts

func (k8s *K8s) SaveTestArtifacts(t *testing.T)

SaveTestArtifacts force saving tests artifacts

func (*K8s) SetForwardingPlane

func (k8s *K8s) SetForwardingPlane(plane string) error

SetForwardingPlane sets which forwarding plane to be used in testing

func (*K8s) UpdatePod

func (k8s *K8s) UpdatePod(pod *v1.Pod) *v1.Pod

UpdatePod updates a pod

func (*K8s) UseIPv6

func (k8s *K8s) UseIPv6() bool

UseIPv6 returns which IP version is going to be used in testing

func (*K8s) WaitLogsContains

func (k8s *K8s) WaitLogsContains(pod *v1.Pod, container, pattern string, timeout time.Duration)

WaitLogsContains waits with timeout for pod::container logs to contain pattern as substring

func (*K8s) WaitLogsContainsRegex

func (k8s *K8s) WaitLogsContainsRegex(pod *v1.Pod, container, pattern string, timeout time.Duration) error

WaitLogsContainsRegex waits with timeout for pod::contained logs to contain substring matching regexp pattern

type MonitorClient

MonitorClient is shorter name for crossconnect.MonitorCrossConnect_MonitorCrossConnectsClient

func CreateCrossConnectClient

func CreateCrossConnectClient(k8s *K8s, address string) (MonitorClient, func(), context.CancelFunc)

CreateCrossConnectClient returns CrossConnectMonitorClient to passed address

type MultipleEventChecker

type MultipleEventChecker struct {
	Events []EventChecker
}

MultipleEventChecker checks subsequence of events in channel

func (*MultipleEventChecker) Check

func (e *MultipleEventChecker) Check(eventCh <-chan *crossconnect.CrossConnectEvent) error

Check implements method from EventChecker interface

type NSCCheckInfo

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

NSCCheckInfo - Structure to hold client ping information

func CheckNSC

func CheckNSC(k8s *K8s, nscPodNode *v1.Pod) *NSCCheckInfo

CheckNSC - Perform default check for client to NSE operations

func CheckVppAgentNSC

func CheckVppAgentNSC(k8s *K8s, nscPodNode *v1.Pod) *NSCCheckInfo

CheckVppAgentNSC - Perform check of VPP based agent operations.

func (*NSCCheckInfo) PrintLogs

func (info *NSCCheckInfo) PrintLogs()

PrintLogs - Print Client print information

type NodeConf

type NodeConf struct {
	Nsmd      *v1.Pod
	Forwarder *v1.Pod
	Node      *v1.Node
}

func SetupNodes

func SetupNodes(k8s *K8s, nodesCount int, timeout time.Duration) ([]*NodeConf, error)

SetupNodes - Setup NSMgr and Forwarder for particular number of nodes in cluster

func SetupNodesConfig

func SetupNodesConfig(k8s *K8s, nodesCount int, timeout time.Duration, conf []*pods.NSMgrPodConfig, namespace string) ([]*NodeConf, error)

SetupNodesConfig - Setup NSMgr and Forwarder for particular number of nodes in cluster

type NscChecker

type NscChecker = func(*K8s, *v1.Pod) *NSCCheckInfo

NscChecker - Type to pass checked for pod

type NsePinger

type NsePinger = func(k8s *K8s, from *v1.Pod) bool

NsePinger - Type to pass pinger for pod

type OrEventChecker

type OrEventChecker struct {
	Event1 EventChecker
	Event2 EventChecker
}

OrEventChecker checks that one of checker - Event1 or Event2 successfully finishes

func (*OrEventChecker) Check

func (e *OrEventChecker) Check(eventCh <-chan *crossconnect.CrossConnectEvent) error

Check implements method from EventChecker interface

type PodDeployResult

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

type PodSupplier

type PodSupplier = func(*K8s, *v1.Node, string, time.Duration) *v1.Pod

PodSupplier - Type to pass supplier of pod

type PortForward

type PortForward struct {

	// The port on the pod to forward traffic to.
	DestinationPort int
	// The port that the port forward should listen to, random if not set.
	ListenPort int
	// contains filtered or unexported fields
}

func (*PortForward) Start

func (p *PortForward) Start() error

Start a port forward to a pod - blocks until the tunnel is ready for use.

func (*PortForward) Stop

func (p *PortForward) Stop()

type SingleEventChecker

type SingleEventChecker struct {
	Timeout   time.Duration
	EventType crossconnect.CrossConnectEventType
	Empty     bool
	SrcUp     bool
	DstUp     bool
}

SingleEventChecker checks single event in channel

func (*SingleEventChecker) Check

func (e *SingleEventChecker) Check(eventCh <-chan *crossconnect.CrossConnectEvent) error

Check implements method from EventChecker interface

type TestingPodFixture

type TestingPodFixture interface {
	DeployNsc(*K8s, *v1.Node, string, time.Duration) *v1.Pod
	DeployNse(*K8s, *v1.Node, string, time.Duration) *v1.Pod
	CheckNsc(*K8s, *v1.Pod) *NSCCheckInfo
}

TestingPodFixture - Tool for help testing pods

func DefaultTestingPodFixture

func DefaultTestingPodFixture(g *WithT) TestingPodFixture

DefaultTestingPodFixture - Creates default testing tool

func NewCustomTestingPodFixture

func NewCustomTestingPodFixture(g *WithT, deployNscFunc, deployNseFunc PodSupplier, checkNscFunc NscChecker) TestingPodFixture

NewCustomTestingPodFixture - Creates a custom testing tool

func VppAgentTestingPodFixture

func VppAgentTestingPodFixture(g *WithT) TestingPodFixture

VppAgentTestingPodFixture - Creates vpp agent specific testing tool

type Writer

type Writer struct {
	Str string
}

func (*Writer) Write

func (w *Writer) Write(p []byte) (n int, err error)

Directories

Path Synopsis
Package artifacts provides API for manage tests artifacts.
Package artifacts provides API for manage tests artifacts.
nolint
nolint

Jump to

Keyboard shortcuts

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