Documentation ¶
Index ¶
- Constants
- Variables
- func CreateIngressMASecret(client kubernetes.Interface, host string, secretName, namespace string) (*tls.Config, error)
- func CreateIngressTLSSecret(client kubernetes.Interface, hosts []string, secretName, namespace string) (*tls.Config, error)
- func CreateKubeNamespace(baseName string, c kubernetes.Interface) (string, error)
- func DeleteKubeNamespace(c kubernetes.Interface, namespace string) error
- func ExpectNoError(err error, explain ...interface{})
- func Failf(format string, args ...interface{})
- func IngressNginxDescribe(text string, body func()) bool
- func LoadConfig(config, context string) (*rest.Config, error)
- func Logf(format string, args ...interface{})
- func Logs(pod *v1.Pod) (string, error)
- func NewInt32(val int32) *int32
- func NewInt64(val int64) *int64
- func NewSingleIngress(name, path, host, ns, service string, port int, annotations *map[string]string) *extensions.Ingress
- func NewSingleIngressWithTLS(name, path, host, ns, service string, port int, annotations *map[string]string) *extensions.Ingress
- func RegisterCommonFlags()
- func RegisterParseFlags()
- func RemoveCleanupAction(p CleanupActionHandle)
- func RestclientConfig(config, context string) (*api.Config, error)
- func RunCleanupActions()
- func Skipf(format string, args ...interface{})
- func UpdateDeployment(kubeClientSet kubernetes.Interface, namespace string, name string, ...) error
- func WaitForFileInFS(file string, fs file.Filesystem) error
- func WaitForIngressInNamespace(c kubernetes.Interface, namespace, name string) error
- func WaitForKubeNamespaceNotExist(c kubernetes.Interface, namespace string) error
- func WaitForNoIngressInNamespace(c kubernetes.Interface, namespace, name string) error
- func WaitForNoPodsInNamespace(c kubernetes.Interface, namespace string) error
- func WaitForPodRunningInNamespace(c kubernetes.Interface, pod *v1.Pod) error
- func WaitForPodsReady(kubeClientSet kubernetes.Interface, timeout time.Duration, ...) error
- func WaitForSecretInNamespace(c kubernetes.Interface, namespace, name string) error
- func WaitForTLS(url string, tlsConfig *tls.Config)
- type CleanupActionHandle
- type Framework
- func (f *Framework) AfterEach()
- func (f *Framework) BeforeEach()
- func (f *Framework) EnsureConfigMap(configMap *api.ConfigMap) (*api.ConfigMap, error)
- func (f *Framework) EnsureDeployment(deployment *extensions.Deployment) (*extensions.Deployment, error)
- func (f *Framework) EnsureIngress(ingress *extensions.Ingress) *extensions.Ingress
- func (f *Framework) EnsureSecret(secret *api.Secret) *api.Secret
- func (f *Framework) EnsureService(service *core.Service) *core.Service
- func (f *Framework) ExecCommand(pod *v1.Pod, command string) (string, error)
- func (f *Framework) GetNginxConfigMapData() (map[string]string, error)
- func (f *Framework) GetNginxIP() string
- func (f *Framework) GetNginxPort(name string) (int, error)
- func (f *Framework) GetNginxURL(scheme RequestScheme) string
- func (f *Framework) KubectlProxy(port int) (int, *exec.Cmd, error)
- func (f *Framework) NewDeployment(name, image string, port int32, replicas int32)
- func (f *Framework) NewEchoDeployment()
- func (f *Framework) NewEchoDeploymentWithReplicas(replicas int32)
- func (f *Framework) NewGRPCFortuneTellerDeployment()
- func (f *Framework) NewHttpbinDeployment()
- func (f *Framework) NewInfluxDBDeployment()
- func (f *Framework) NewIngressController(namespace string) error
- func (f *Framework) NewNewGRPCFortuneTellerDeploymentWithReplicas(replicas int32)
- func (f *Framework) NginxLogs() (string, error)
- func (f *Framework) SetNginxConfigMapData(cmData map[string]string)
- func (f *Framework) UpdateNginxConfigMapData(key string, value string)
- func (f *Framework) WaitForNginxConfiguration(matcher func(cfg string) bool)
- func (f *Framework) WaitForNginxServer(name string, matcher func(cfg string) bool)
- type RequestScheme
- type TestContextType
Constants ¶
const ( // Poll how often to poll for conditions Poll = 2 * time.Second )
Variables ¶
var (
// KubectlPath defines the full path of the kubectl binary
KubectlPath = "/usr/local/bin/kubectl"
)
var RunID = uuid.NewUUID()
RunID unique identifier of the e2e run
Functions ¶
func CreateIngressMASecret ¶
func CreateIngressMASecret(client kubernetes.Interface, host string, secretName, namespace string) (*tls.Config, error)
CreateIngressMASecret creates or updates a Secret containing a Mutual Auth certificate-chain for the given Ingress and returns a TLS configuration suitable for HTTP clients to use against that particular Ingress.
func CreateIngressTLSSecret ¶
func CreateIngressTLSSecret(client kubernetes.Interface, hosts []string, secretName, namespace string) (*tls.Config, error)
CreateIngressTLSSecret creates or updates a Secret containing a TLS certificate for the given Ingress and returns a TLS configuration suitable for HTTP clients to use against that particular Ingress.
func CreateKubeNamespace ¶
func CreateKubeNamespace(baseName string, c kubernetes.Interface) (string, error)
CreateKubeNamespace 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 ExpectNoError ¶
func ExpectNoError(err error, explain ...interface{})
ExpectNoError tests whether an error occurred.
func Failf ¶
func Failf(format string, args ...interface{})
Failf logs to the INFO logs and fails the test.
func IngressNginxDescribe ¶
IngressNginxDescribe wrapper function for ginkgo describe. Adds namespacing.
func LoadConfig ¶
LoadConfig deserializes the contents of a kubeconfig file into a REST configuration.
func NewSingleIngress ¶
func NewSingleIngress(name, path, host, ns, service string, port int, annotations *map[string]string) *extensions.Ingress
NewSingleIngress creates a simple ingress rule
func NewSingleIngressWithTLS ¶
func NewSingleIngressWithTLS(name, path, host, ns, service string, port int, annotations *map[string]string) *extensions.Ingress
NewSingleIngressWithTLS creates a simple ingress rule with TLS spec included
func RegisterCommonFlags ¶
func RegisterCommonFlags()
RegisterCommonFlags registers flags common to all e2e test suites.
func RegisterParseFlags ¶
func RegisterParseFlags()
RegisterParseFlags registers and parses flags for the test binary.
func RemoveCleanupAction ¶
func RemoveCleanupAction(p CleanupActionHandle)
RemoveCleanupAction removes a function that was installed by AddCleanupAction.
func RestclientConfig ¶
RestclientConfig deserializes the contents of a kubeconfig file into a Config object.
func RunCleanupActions ¶
func RunCleanupActions()
RunCleanupActions runs all functions installed by AddCleanupAction. It does not remove them (see RemoveCleanupAction) but it does run unlocked, so they may remove themselves.
func Skipf ¶
func Skipf(format string, args ...interface{})
Skipf logs to the INFO logs and skips the test.
func UpdateDeployment ¶
func UpdateDeployment(kubeClientSet kubernetes.Interface, namespace string, name string, replicas int, updateFunc func(d *appsv1beta1.Deployment) error) error
UpdateDeployment runs the given updateFunc on the deployment and waits for it to be updated
func WaitForFileInFS ¶
func WaitForFileInFS(file string, fs file.Filesystem) error
WaitForFileInFS waits a default amount of time for the specified file is present in the filesystem
func WaitForIngressInNamespace ¶
func WaitForIngressInNamespace(c kubernetes.Interface, namespace, name string) error
WaitForIngressInNamespace waits until a particular ingress object exists namespace
func WaitForKubeNamespaceNotExist ¶
func WaitForKubeNamespaceNotExist(c kubernetes.Interface, namespace string) error
WaitForKubeNamespaceNotExist waits until a namespaces is not present in the cluster
func WaitForNoIngressInNamespace ¶
func WaitForNoIngressInNamespace(c kubernetes.Interface, namespace, name string) error
WaitForNoIngressInNamespace waits until there is no ingress object in a particular namespace
func WaitForNoPodsInNamespace ¶
func WaitForNoPodsInNamespace(c kubernetes.Interface, namespace string) error
WaitForNoPodsInNamespace waits until there are no pods running in a namespace
func WaitForPodRunningInNamespace ¶
func WaitForPodRunningInNamespace(c kubernetes.Interface, pod *v1.Pod) error
WaitForPodRunningInNamespace waits a default amount of time (PodStartTimeout) for the specified pod to become running. Returns an error if timeout occurs first, or pod goes in to failed state.
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 WaitForSecretInNamespace ¶
func WaitForSecretInNamespace(c kubernetes.Interface, namespace, name string) error
WaitForSecretInNamespace waits a default amount of time for the specified secret is present in a particular namespace
func WaitForTLS ¶
WaitForTLS waits until the TLS handshake with a given server completes successfully.
Types ¶
type CleanupActionHandle ¶
type CleanupActionHandle *int
CleanupActionHandle is a handle used to perform a cleanup action.
func AddCleanupAction ¶
func AddCleanupAction(fn func()) CleanupActionHandle
AddCleanupAction installs a function that will be called in the event of the whole test being terminated. This allows arbitrary pieces of the overall test to hook into SynchronizedAfterSuite().
type Framework ¶
type Framework struct { BaseName string // A Kubernetes and Service Catalog client KubeClientSet kubernetes.Interface KubeConfig *restclient.Config APIExtensionsClientSet apiextcs.Interface IngressController *ingressController // contains filtered or unexported fields }
Framework supports common operations used by e2e tests; it will keep a client & a namespace for you.
func NewDefaultFramework ¶
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 ¶
EnsureConfigMap creates a ConfigMap object or returns it if it already exists.
func (*Framework) EnsureDeployment ¶
func (f *Framework) EnsureDeployment(deployment *extensions.Deployment) (*extensions.Deployment, error)
EnsureDeployment creates a Deployment object or returns it if it already exists.
func (*Framework) EnsureIngress ¶
func (f *Framework) EnsureIngress(ingress *extensions.Ingress) *extensions.Ingress
EnsureIngress creates an Ingress object or returns it if it already exists.
func (*Framework) EnsureSecret ¶
EnsureSecret creates a Secret object or returns it if it already exists.
func (*Framework) EnsureService ¶
EnsureService creates a Service object or returns it if it already exists.
func (*Framework) ExecCommand ¶
ExecCommand executes a command inside a the first container in a running pod
func (*Framework) GetNginxConfigMapData ¶
GetNginxConfigMapData gets ingress-nginx's nginx-configuration map's data
func (*Framework) GetNginxIP ¶
GetNginxIP returns the IP address of the minikube cluster where the NGINX ingress controller is running
func (*Framework) GetNginxPort ¶
GetNginxPort returns the number of TCP port where NGINX is running
func (*Framework) GetNginxURL ¶
func (f *Framework) GetNginxURL(scheme RequestScheme) string
GetNginxURL returns the URL should be used to make a request to NGINX
func (*Framework) KubectlProxy ¶
KubectlProxy creates a proxy to kubernetes apiserver
func (*Framework) NewDeployment ¶
NewDeployment creates a new deployment in a particular namespace.
func (*Framework) NewEchoDeployment ¶
func (f *Framework) NewEchoDeployment()
NewEchoDeployment creates a new single replica deployment of the echoserver image in a particular namespace
func (*Framework) NewEchoDeploymentWithReplicas ¶
NewEchoDeploymentWithReplicas creates a new deployment of the echoserver image in a particular namespace. Number of replicas is configurable
func (*Framework) NewGRPCFortuneTellerDeployment ¶
func (f *Framework) NewGRPCFortuneTellerDeployment()
NewGRPCFortuneTellerDeployment creates a new single replica deployment of the fortune teller image in a particular namespace
func (*Framework) NewHttpbinDeployment ¶
func (f *Framework) NewHttpbinDeployment()
NewHttpbinDeployment creates a new single replica deployment of the httpbin image in a particular namespace.
func (*Framework) NewInfluxDBDeployment ¶
func (f *Framework) NewInfluxDBDeployment()
NewInfluxDBDeployment creates an InfluxDB server configured to reply on 8086/tcp and 8089/udp
func (*Framework) NewIngressController ¶
NewIngressController deploys a new NGINX Ingress controller in a namespace
func (*Framework) NewNewGRPCFortuneTellerDeploymentWithReplicas ¶
NewNewGRPCFortuneTellerDeploymentWithReplicas creates a new deployment of the fortune teller image in a particular namespace. Number of replicas is configurable
func (*Framework) NginxLogs ¶
NginxLogs returns the logs of the nginx ingress controller pod running
func (*Framework) SetNginxConfigMapData ¶
SetNginxConfigMapData sets ingress-nginx's nginx-configuration configMap data
func (*Framework) UpdateNginxConfigMapData ¶
UpdateNginxConfigMapData updates single field in ingress-nginx's nginx-configuration map data
func (*Framework) WaitForNginxConfiguration ¶
WaitForNginxConfiguration waits until the nginx configuration contains a particular configuration
type RequestScheme ¶
type RequestScheme string
RequestScheme define a scheme used in a test request.
const ( HTTP RequestScheme = "http" HTTPS RequestScheme = "https" )
These are valid test request schemes.
type TestContextType ¶
TestContextType describes the client context to use in communications with the Kubernetes API.
var TestContext TestContextType
TestContext is the global client context for tests.