Documentation ¶
Index ¶
- Constants
- type EchoEnv
- type EchoResponse
- type Framework
- func (f *Framework) CheckTestPrerequisites() error
- func (f *Framework) CreateEchoPod(namespace, name string) (*corev1.Pod, error)
- func (f *Framework) CreateEdgeLBIngress(namespace, name string, fn IngressCustomizer) (*extsv1beta1.Ingress, error)
- func (f *Framework) CreateIngress(namespace, name string, fn IngressCustomizer) (*extsv1beta1.Ingress, error)
- func (f *Framework) CreateIngressFromYamlSpec(spec string) (*extsv1beta1.Ingress, error)
- func (f *Framework) CreatePod(namespace, name string, fn PodCustomizer) (*corev1.Pod, error)
- func (f *Framework) CreateSecret(namespace, name string, fn SecretCustomizer) (*corev1.Secret, error)
- func (f *Framework) CreateService(namespace, name string, fn ServiceCustomizer) (*corev1.Service, error)
- func (f *Framework) CreateServiceForEchoPod(pod *corev1.Pod) (*corev1.Service, error)
- func (f *Framework) CreateServiceOfTypeLoadBalancer(namespace, name string, fn ServiceCustomizer) (*corev1.Service, error)
- func (f *Framework) DeleteEdgeLBPool(pool *models.V2Pool)
- func (f *Framework) EchoRequest(method, host string, port int32, path string, headers map[string]string) (*EchoResponse, error)
- func (f *Framework) Request(method, host, path string) (int, string, error)
- func (f *Framework) UpdateIngressEdgeLBPoolSpec(ingress *extsv1beta1.Ingress, fn IngressEdgeLBPoolSpecCustomizer) (*extsv1beta1.Ingress, error)
- func (f *Framework) UpdateServiceEdgeLBPoolSpec(service *corev1.Service, fn ServiceEdgeLBPoolSpecCustomizer) (*corev1.Service, error)
- func (f *Framework) WaitEdgeLBPoolDelete(pool *models.V2Pool)
- func (f *Framework) WaitForHostnameForService(ctx context.Context, service *corev1.Service) (string, error)
- func (f *Framework) WaitForPublicIPForIngress(ctx context.Context, ingress *extsv1beta1.Ingress) (string, error)
- func (f *Framework) WaitForPublicIPForService(ctx context.Context, service *corev1.Service) (string, error)
- func (f *Framework) WaitUntilIngressCondition(ctx context.Context, ingress *extsv1beta1.Ingress, fn watch.ConditionFunc) error
- func (f *Framework) WaitUntilServiceCondition(ctx context.Context, service *corev1.Service, fn watch.ConditionFunc) error
- func (f *Framework) WithTemporaryNamespace(fn func(namespace *corev1.Namespace))
- type IngressCustomizer
- type IngressEdgeLBPoolSpecCustomizer
- type PodCustomizer
- type SecretCustomizer
- type ServiceCustomizer
- type ServiceEdgeLBPoolSpecCustomizer
Constants ¶
const ( // DefaultRetryInterval is the default interval to use in "retry" operations. DefaultRetryInterval = 10 * time.Second // DefaultRetryTimeout is the default timeout to use in "retry" operations. DefaultRetryTimeout = 3 * time.Minute // DefaultEdgeLBOperationTimeout is the default timeout to use for EdgeLB operations. DefaultEdgeLBOperationTimeout = 5 * time.Second )
const (
// KubernetesNamespacePrefix is the prefix used for Kubernetes namespaces created by the test suite.
KubernetesNamespacePrefix = "dklb-e2e-"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EchoEnv ¶
type EchoEnv struct { Namespace string `json:"namespace,omitempty"` Pod string `json:"pod,omitempty"` }
EchoEnv is a structure used to unmarshal the ".k8sEnv" field of "echo" responses.
type EchoResponse ¶
type EchoResponse struct { K8sEnv EchoEnv `json:"k8sEnv,omitempty"` Header map[string][]string `json:"header,omitempty"` Host string `json:"host,omitempty"` Method string `json:"method,omitempty"` URI string `json:"uri,omitempty"` }
EchoResponse is a structure used to unmarshal "echo" responses.
func (*EchoResponse) XForwardedForContains ¶
func (r *EchoResponse) XForwardedForContains(v string) bool
XForwardedForContains returns a value indicating whether the "X-Forwarded-For" header contains the specified value.
type Framework ¶
type Framework struct { // ClusterName is the name of the Mesos framework that corresponds to the Kubernetes cluster where testing will be performed. ClusterName string // EdgeLBManager is the instance of the EdgeLB manager to use. EdgeLBManager edgelbmanager.EdgeLBManager // ExternalIP is the external IP of the host where the test suite is running on. ExternalIP string // HTTPClient is the client used to make HTTP requests. HTTPClient *http.Client // KubeClient is a client to the Kubernetes base APIs. KubeClient kubernetes.Interface }
Framework groups together utility methods and clients used by test functions.
func New ¶
func New(edgelbOptions edgelbmanager.EdgeLBManagerOptions, kubeconfig string) *Framework
New returns a new instance of the testing framework.
func (*Framework) CheckTestPrerequisites ¶
CheckTestPrerequisites checks if the prerequisites for running a single test are met. These prerequisites include no pre-existing Kubernetes namespaces starting with "KubernetesNamespacePrefix", and no pre-existing EdgeLB pools.
func (*Framework) CreateEchoPod ¶
CreateEchoPod creates an "echo" pod in the specified namespace with the provided name.
func (*Framework) CreateEdgeLBIngress ¶
func (f *Framework) CreateEdgeLBIngress(namespace, name string, fn IngressCustomizer) (*extsv1beta1.Ingress, error)
CreateEdgeLBIngress creates the Ingress resource with the specified namespace and name in the Kubernetes API after running it through the specified customization function. The Ingress is explicitly annotated to be provisioned by EdgeLB.
func (*Framework) CreateIngress ¶
func (f *Framework) CreateIngress(namespace, name string, fn IngressCustomizer) (*extsv1beta1.Ingress, error)
CreateIngress creates the Ingress resource with the specified namespace and name in the Kubernetes API after running it through the specified customization function.
func (*Framework) CreateIngressFromYamlSpec ¶ added in v1.0.1
func (f *Framework) CreateIngressFromYamlSpec(spec string) (*extsv1beta1.Ingress, error)
CreateIngressFromYamlSpec creates the Ingress resource from the given spec.
func (*Framework) CreatePod ¶
CreatePod creates the pod with the specified namespace and name in the Kubernetes API after running it through the specified customization function.
func (*Framework) CreateSecret ¶
func (f *Framework) CreateSecret(namespace, name string, fn SecretCustomizer) (*corev1.Secret, error)
CreateSecret creates the Secret resource with the specified namespace and name in the Kubernetes API after running it through the specified customization function.
func (*Framework) CreateService ¶
func (f *Framework) CreateService(namespace, name string, fn ServiceCustomizer) (*corev1.Service, error)
CreateService creates the Service resource with the specified namespace and name in the Kubernetes API after running it through the specified customization function.
func (*Framework) CreateServiceForEchoPod ¶
CreateServiceForEchoPod creates a Service resource of type NodePort targeting the specified "echo" pod.
func (*Framework) CreateServiceOfTypeLoadBalancer ¶
func (f *Framework) CreateServiceOfTypeLoadBalancer(namespace, name string, fn ServiceCustomizer) (*corev1.Service, error)
CreateServiceOfTypeLoadBalancer creates the Service resource of type LoadBalancer with the specified namespace and name in the Kubernetes API after running it through the specified customization function.
func (*Framework) DeleteEdgeLBPool ¶
DeleteEdgeLBPool deletes the specified EdgeLB pool and waits for the EdgeLB API server to stop reporting it as existing.
func (*Framework) EchoRequest ¶
func (f *Framework) EchoRequest(method, host string, port int32, path string, headers map[string]string) (*EchoResponse, error)
EchoRequest performs a "method" request to the specified host and path, returning the resulting "echo" response or an error. TODO (@bcustodio) Add support for HTTPS if/when necessary.
func (*Framework) Request ¶
Request performs a "method" request to the specified host and path, returning the status code and the response's body. TODO (@bcustodio) Add support for HTTPS if/when necessary.
func (*Framework) UpdateIngressEdgeLBPoolSpec ¶
func (f *Framework) UpdateIngressEdgeLBPoolSpec(ingress *extsv1beta1.Ingress, fn IngressEdgeLBPoolSpecCustomizer) (*extsv1beta1.Ingress, error)
UpdateIngressEdgeLBPoolSpec updates the EdgeLB pool specification contained in specified Ingress resource according to the supplied customization function.
func (*Framework) UpdateServiceEdgeLBPoolSpec ¶
func (f *Framework) UpdateServiceEdgeLBPoolSpec(service *corev1.Service, fn ServiceEdgeLBPoolSpecCustomizer) (*corev1.Service, error)
UpdateServiceEdgeLBPoolSpec updates the EdgeLB pool specification contained in specified Service resource according to the supplied customization function.
func (*Framework) WaitEdgeLBPoolDelete ¶
WaitEdgeLBPoolDelete waits for the EdgeLB API server to stop reporting the EdgeLB pool as existing.
func (*Framework) WaitForHostnameForService ¶
func (f *Framework) WaitForHostnameForService(ctx context.Context, service *corev1.Service) (string, error)
WaitForHostnameForService blocks until a hostname is reported for the specified Service resource, or until the provided context times out.
func (*Framework) WaitForPublicIPForIngress ¶
func (f *Framework) WaitForPublicIPForIngress(ctx context.Context, ingress *extsv1beta1.Ingress) (string, error)
WaitForPublicIPForIngress blocks until a public IP is reported for the specified Service resource, or until the provided context times out.
func (*Framework) WaitForPublicIPForService ¶
func (f *Framework) WaitForPublicIPForService(ctx context.Context, service *corev1.Service) (string, error)
WaitForPublicIPForService blocks until a public IP is reported for the specified Service resource, or until the provided context times out.
func (*Framework) WaitUntilIngressCondition ¶
func (f *Framework) WaitUntilIngressCondition(ctx context.Context, ingress *extsv1beta1.Ingress, fn watch.ConditionFunc) error
WaitUntilIngressCondition blocks until the specified condition function is verified, or until the provided context times out.
func (*Framework) WaitUntilServiceCondition ¶
func (f *Framework) WaitUntilServiceCondition(ctx context.Context, service *corev1.Service, fn watch.ConditionFunc) error
WaitUntilServiceCondition blocks until the specified condition function is verified, or until the provided context times out.
func (*Framework) WithTemporaryNamespace ¶
WithTemporaryNamespace creates a Kubernetes namespace with a randomly generated name, calls the provided function with the namespace as its parameter, and deletes the namespace after said function returns.
type IngressCustomizer ¶
type IngressCustomizer func(ingress *extsv1beta1.Ingress)
IngressCustomizer represents a function that can be used to customize an Ingress resource.
type IngressEdgeLBPoolSpecCustomizer ¶
type IngressEdgeLBPoolSpecCustomizer func(spec *translatorapi.IngressEdgeLBPoolSpec)
type PodCustomizer ¶
PodCustomizer represents a function that can be used to customize a Pod resource.
type SecretCustomizer ¶
SecretCustomizer represents a function that can be used to customize a Secret resource.
type ServiceCustomizer ¶
ServiceCustomizer represents a function that can be used to customize a Service resource.
type ServiceEdgeLBPoolSpecCustomizer ¶
type ServiceEdgeLBPoolSpecCustomizer func(spec *translatorapi.ServiceEdgeLBPoolSpec)