Documentation ¶
Index ¶
- Variables
- func BuildClientConfig(kubeConfigPath string, clusterName string) (*rest.Config, error)
- func CheckEndpointState(ctx context.Context, kubeClient kubernetes.Interface, ...) (*spoof.Response, error)
- func CleanupOnInterrupt(f func(), log logFunc)
- func ClusterRoleBinding(name string, namespace string, serviceAccount string, role string) *rbacv1.ClusterRoleBinding
- func CoreV1ObjectReference(kind, apiversion, name string) *corev1.ObjectReference
- func CreatePod(ctx context.Context, client kubernetes.Interface, pod *corev1.Pod) (*corev1.Pod, error)
- func DeploymentScaledToZeroFunc() func(d *appsv1.Deployment) (bool, error)
- func GetConfigMap(client kubernetes.Interface, namespace string) k8styped.ConfigMapInterface
- func GetEndpointAddresses(ctx context.Context, client kubernetes.Interface, svcName, svcNamespace string) ([]string, error)
- func ImagePath(name string) string
- func NewSpoofingClient(ctx context.Context, client kubernetes.Interface, logf logging.FormatLogger, ...) (*spoof.SpoofingClient, error)
- func NginxPod(namespace string) *corev1.Pod
- func OnInterrupt(cleanupFunc func())
- func PodLogs(ctx context.Context, client kubernetes.Interface, ...) ([]byte, error)
- func ServiceAccount(name, namespace string) *corev1.ServiceAccount
- func SetupLoggingFlags()
- func UpdateConfigMap(ctx context.Context, client kubernetes.Interface, name string, ...) error
- func WaitForAllPodsRunning(ctx context.Context, client kubernetes.Interface, namespace string) error
- func WaitForChangedEndpoints(ctx context.Context, client kubernetes.Interface, svcName, svcNamespace string, ...) error
- func WaitForDeploymentScale(ctx context.Context, client kubernetes.Interface, name, namespace string, ...) error
- func WaitForDeploymentState(ctx context.Context, client kubernetes.Interface, name string, ...) error
- func WaitForEndpointState(ctx context.Context, kubeClient kubernetes.Interface, ...) (*spoof.Response, error)
- func WaitForEndpointStateWithTimeout(ctx context.Context, kubeClient kubernetes.Interface, ...) (*spoof.Response, error)
- func WaitForLogContent(ctx context.Context, client kubernetes.Interface, ...) error
- func WaitForPodDeleted(ctx context.Context, client kubernetes.Interface, name, namespace string) error
- func WaitForPodListState(ctx context.Context, client kubernetes.Interface, ...) error
- func WaitForPodRunning(ctx context.Context, client kubernetes.Interface, name string, ...) error
- func WaitForPodState(ctx context.Context, client kubernetes.Interface, ...) error
- func WaitForServiceEndpoints(ctx context.Context, client kubernetes.Interface, svcName string, ...) error
- type EnvironmentFlags
- type RequestOption
- type T
- type TLegacy
Constants ¶
This section is empty.
Variables ¶
var ( // Flags holds the command line flags or defaults for settings in the user's environment. // See EnvironmentFlags for a list of supported fields. // Deprecated: use test/flags.Flags() Flags = initializeFlags() )
var IsOneOfStatusCodes = spoof.IsOneOfStatusCodes
IsOneOfStatusCodes checks that the response code is equal to the given one.
Deprecated: Use the spoof package version
var IsStatusOK = spoof.IsStatusOK
IsStatusOK checks that the response code is a 200.
Deprecated: Use the spoof package version
var MatchesAllBodies = spoof.MatchesAllBodies
MatchesAllBodies checks that the *first* response body matches the "expected" body, otherwise failing.
Deprecated: Use the spoof package version
var MatchesAllOf = spoof.MatchesAllOf
MatchesAllOf combines multiple ResponseCheckers to one ResponseChecker with a logical AND. The checkers are executed in order. The first function to trigger an error or a retry will short-circuit the other functions (they will not be executed).
This is useful for combining a body with a status check like: MatchesAllOf(IsStatusOK, MatchesBody("test"))
The MatchesBody check will only be executed after the IsStatusOK has passed.
Deprecated: Use the spoof package version
var MatchesBody = spoof.MatchesBody
MatchesBody checks that the *first* response body matches the "expected" body, otherwise failing.
Deprecated: Use the spoof package version
var WithHeader = spoof.WithHeader
WithHeader will add the provided headers to the request.
Deprecated: Use the spoof package version
Functions ¶
func BuildClientConfig ¶
BuildClientConfig builds the client config specified by the config path and the cluster name
func CheckEndpointState ¶
func CheckEndpointState( ctx context.Context, kubeClient kubernetes.Interface, logf logging.FormatLogger, url *url.URL, inState spoof.ResponseChecker, desc string, resolvable bool, opts ...interface{}, ) (*spoof.Response, error)
func CleanupOnInterrupt ¶
func CleanupOnInterrupt(f func(), log logFunc)
CleanupOnInterrupt will execute the function if an interrupt signal is caught Deprecated - use OnInterrupt
func ClusterRoleBinding ¶
func ClusterRoleBinding(name string, namespace string, serviceAccount string, role string) *rbacv1.ClusterRoleBinding
ClusterRoleBinding returns ClusterRoleBinding for given subject and role
func CoreV1ObjectReference ¶
func CoreV1ObjectReference(kind, apiversion, name string) *corev1.ObjectReference
CoreV1ObjectReference returns a corev1.ObjectReference for the given name, kind and apiversion
func CreatePod ¶
func CreatePod(ctx context.Context, client kubernetes.Interface, pod *corev1.Pod) (*corev1.Pod, error)
CreatePod will create a Pod
func DeploymentScaledToZeroFunc ¶
func DeploymentScaledToZeroFunc() func(d *appsv1.Deployment) (bool, error)
DeploymentScaledToZeroFunc returns a func that evaluates if a deployment has scaled to 0 pods
func GetConfigMap ¶
func GetConfigMap(client kubernetes.Interface, namespace string) k8styped.ConfigMapInterface
GetConfigMap gets the configmaps for a given namespace
func GetEndpointAddresses ¶
func GetEndpointAddresses(ctx context.Context, client kubernetes.Interface, svcName, svcNamespace string) ([]string, error)
GetEndpointAddresses returns addresses of endpoints for the given service.
func ImagePath ¶
ImagePath is a helper function to transform an image name into an image reference that can be pulled.
func NewSpoofingClient ¶
func NewSpoofingClient(ctx context.Context, client kubernetes.Interface, logf logging.FormatLogger, domain string, resolvable bool, opts ...spoof.TransportOption) (*spoof.SpoofingClient, error)
NewSpoofingClient returns a spoofing client to make requests
func OnInterrupt ¶
func OnInterrupt(cleanupFunc func())
OnInterrupt registers a cleanup function to run if an interrupt signal is caught
func PodLogs ¶
func PodLogs(ctx context.Context, client kubernetes.Interface, podName, containerName, namespace string) ([]byte, error)
PodLogs returns Pod logs for given Pod and Container in the namespace
func ServiceAccount ¶
func ServiceAccount(name, namespace string) *corev1.ServiceAccount
ServiceAccount returns ServiceAccount object in given namespace
func SetupLoggingFlags ¶
func SetupLoggingFlags()
SetupLoggingFlags initializes a logger for tests. TODO(coryrc): Remove once other repos are moved to call logging.InitializeLogger() directly
func UpdateConfigMap ¶
func UpdateConfigMap(ctx context.Context, client kubernetes.Interface, name string, configName string, values map[string]string) error
UpdateConfigMap updates the config map for specified @name with values
func WaitForAllPodsRunning ¶
func WaitForAllPodsRunning(ctx context.Context, client kubernetes.Interface, namespace string) error
WaitForAllPodsRunning waits for all the pods to be in running state
func WaitForChangedEndpoints ¶
func WaitForChangedEndpoints(ctx context.Context, client kubernetes.Interface, svcName, svcNamespace string, origEndpoints []string) error
WaitForChangedEndpoints waits until the endpoints for the given service differ from origEndpoints.
func WaitForDeploymentScale ¶
func WaitForDeploymentScale(ctx context.Context, client kubernetes.Interface, name, namespace string, scale int) error
WaitForDeploymentScale waits until the given deployment has the expected scale.
func WaitForDeploymentState ¶
func WaitForDeploymentState(ctx context.Context, client kubernetes.Interface, name string, inState func(d *appsv1.Deployment) (bool, error), desc string, namespace string, timeout time.Duration) error
WaitForDeploymentState polls the status of the Deployment called name from client every interval until inState returns `true` indicating it is done, returns an error or timeout. desc will be used to name the metric that is emitted to track how long it took for name to get into the state checked by inState.
func WaitForEndpointState ¶
func WaitForEndpointState( ctx context.Context, kubeClient kubernetes.Interface, logf logging.FormatLogger, url *url.URL, inState spoof.ResponseChecker, desc string, resolvable bool, opts ...interface{}) (*spoof.Response, error)
WaitForEndpointState will poll an endpoint until inState indicates the state is achieved, or default timeout is reached. If resolvableDomain is false, it will use kubeClientset to look up the ingress and spoof the domain in the request headers, otherwise it will make the request directly to domain. desc will be used to name the metric that is emitted to track how long it took for the domain to get into the state checked by inState. Commas in `desc` must be escaped.
func WaitForEndpointStateWithTimeout ¶
func WaitForEndpointStateWithTimeout( ctx context.Context, kubeClient kubernetes.Interface, logf logging.FormatLogger, url *url.URL, inState spoof.ResponseChecker, desc string, resolvable bool, timeout time.Duration, opts ...interface{}) (*spoof.Response, error)
WaitForEndpointStateWithTimeout will poll an endpoint until inState indicates the state is achieved or the provided timeout is achieved. If resolvableDomain is false, it will use kubeClientset to look up the ingress and spoof the domain in the request headers, otherwise it will make the request directly to domain. desc will be used to name the metric that is emitted to track how long it took for the domain to get into the state checked by inState. Commas in `desc` must be escaped.
func WaitForLogContent ¶
func WaitForLogContent(ctx context.Context, client kubernetes.Interface, podName, containerName, namespace, content string) error
WaitForLogContent waits until logs for given Pod/Container include the given content. If the content is not present within timeout it returns error.
func WaitForPodDeleted ¶
func WaitForPodDeleted(ctx context.Context, client kubernetes.Interface, name, namespace string) error
WaitForPodDeleted waits for the given pod to disappear from the given namespace.
func WaitForPodListState ¶
func WaitForPodListState(ctx context.Context, client kubernetes.Interface, inState func(p *corev1.PodList) (bool, error), desc string, namespace string) error
WaitForPodListState polls the status of the PodList from client every interval until inState returns `true` indicating it is done, returns an error or timeout. desc will be used to name the metric that is emitted to track how long it took to get into the state checked by inState.
func WaitForPodRunning ¶
func WaitForPodRunning(ctx context.Context, client kubernetes.Interface, name string, namespace string) error
WaitForPodRunning waits for the given pod to be in running state
func WaitForPodState ¶
func WaitForPodState(ctx context.Context, client kubernetes.Interface, inState func(p *corev1.Pod) (bool, error), name string, namespace string) error
WaitForPodState polls the status of the specified Pod from client every interval until inState returns `true` indicating it is done, returns an error or timeout. desc will be used to name the metric that is emitted to track how long it took to get into the state checked by inState.
func WaitForServiceEndpoints ¶
func WaitForServiceEndpoints(ctx context.Context, client kubernetes.Interface, svcName string, svcNamespace string, numOfEndpoints int) error
WaitForServiceEndpoints polls the status of the specified Service from client every interval until number of service endpoints = numOfEndpoints
Types ¶
type EnvironmentFlags ¶
type EnvironmentFlags struct { env.ClientConfig testenv.TestClientConfig }
EnvironmentFlags define the flags that are needed to run the e2e tests. Deprecated: use test/flags.Flags() or injection.Flags()
type RequestOption ¶
type RequestOption = spoof.RequestOption
RequestOption enables configuration of requests when polling for endpoint states.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Helper functions for running interactive CLI sessions from Go
|
Helper functions for running interactive CLI sessions from Go |
Package logstream lets end-to-end tests incorporate controller logs into the error output of tests.
|
Package logstream lets end-to-end tests incorporate controller logs into the error output of tests. |
Package monitoring provides common methods for all the monitoring components used in the tests
|
Package monitoring provides common methods for all the monitoring components used in the tests |
vegeta
|
|
Package zipkin adds Zipkin tracing support that can be used in conjunction with SpoofingClient to log zipkin traces for requests that have encountered server errors i.e HTTP request that have HTTP status between 500 to 600.
|
Package zipkin adds Zipkin tracing support that can be used in conjunction with SpoofingClient to log zipkin traces for requests that have encountered server errors i.e HTTP request that have HTTP status between 500 to 600. |