framework

package
v0.0.0-...-42c7111 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2018 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxRetry = 200
	NoRetry  = 1
)
View Source
const (
	// Poll how often to poll for conditions
	Poll = 2 * time.Second
)
View Source
const (
	RecommendedConfigPathEnvVar = "INGRESSNGINXCONFIG"
)

Variables

View Source
var RunID = uuid.NewUUID()

RunID unique identifier of the e2e run

Functions

func CreateIngressTLSSecret

func CreateIngressTLSSecret(client kubernetes.Interface, hosts []string, secretName, namespace string) (host string, rootCA, privKey []byte, err error)

CreateIngressTLSSecret creates a secret containing TLS certificates for the given Ingress. If a secret with the same name already pathExists in the namespace of the Ingress, it's updated.

func CreateKubeNamespace

func CreateKubeNamespace(baseName string, c kubernetes.Interface) (*v1.Namespace, 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{})

func Failf

func Failf(format string, args ...interface{})

func IngressNginxDescribe

func IngressNginxDescribe(text string, body func()) bool

IngressNginxDescribe wrapper function for ginkgo describe. Adds namespacing.

func LoadConfig

func LoadConfig(config, context string) (*rest.Config, error)

func Logf

func Logf(format string, args ...interface{})

func NewInt32

func NewInt32(val int32) *int32

NewInt32 converts int32 to a pointer

func NewInt64

func NewInt64(val int64) *int64

NewInt64 converts int64 to a pointer

func RegisterCommonFlags

func RegisterCommonFlags()

Register flags common to all e2e test suites.

func RegisterParseFlags

func RegisterParseFlags()

func RemoveCleanupAction

func RemoveCleanupAction(p CleanupActionHandle)

RemoveCleanupAction removes a function that was installed by AddCleanupAction.

func RestclientConfig

func RestclientConfig(config, context string) (*api.Config, error)

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{})

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 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

Types

type CleanupActionHandle

type CleanupActionHandle *int

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 ClientConfigGetter

type ClientConfigGetter func() (*rest.Config, error)

type Framework

type Framework struct {
	BaseName string

	// A Kubernetes and Service Catalog client
	KubeClientSet          kubernetes.Interface
	KubeConfig             *restclient.Config
	APIExtensionsClientSet apiextcs.Interface

	// Namespace in which all test resources should reside
	Namespace *v1.Namespace

	NginxHTTPURL  string
	NginxHTTPSURL string
	// contains filtered or unexported fields
}

Framework supports common operations used by e2e tests; it will keep a client & a namespace for you.

func NewDefaultFramework

func NewDefaultFramework(baseName string) *Framework

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) EnsureDeployment

func (f *Framework) EnsureDeployment(deployment *extensions.Deployment) (*extensions.Deployment, error)

func (*Framework) EnsureIngress

func (f *Framework) EnsureIngress(ingress *extensions.Ingress) (*extensions.Ingress, error)

func (*Framework) EnsureSecret

func (f *Framework) EnsureSecret(secret *api.Secret) (*api.Secret, error)

func (*Framework) EnsureService

func (f *Framework) EnsureService(service *core.Service) (*core.Service, error)

func (*Framework) ExecCommand

func (f *Framework) ExecCommand(pod *v1.Pod, command string) (string, error)

ExecCommand executes a command inside a the first container in a running pod

func (*Framework) GetNginxIP

func (f *Framework) GetNginxIP() (string, error)

GetNginxIP returns the IP address of the minikube cluster where the NGINX ingress controller is running

func (*Framework) GetNginxPort

func (f *Framework) GetNginxPort(name string) (int, error)

GetNginxPort returns the number of TCP port where NGINX is running

func (*Framework) GetNginxURL

func (f *Framework) GetNginxURL(scheme RequestScheme) (string, error)

GetNginxURL returns the URL should be used to make a request to NGINX

func (*Framework) Logs

func (f *Framework) Logs(pod *v1.Pod) (string, error)

func (*Framework) NewEchoDeployment

func (f *Framework) NewEchoDeployment() error

NewEchoDeployment creates a new single replica deployment of the echoserver image in a particular namespace

func (*Framework) NewEchoDeploymentWithReplicas

func (f *Framework) NewEchoDeploymentWithReplicas(replicas int32) error

NewEchoDeploymentWithReplicas creates a new deployment of the echoserver image in a particular namespace. Number of replicas is configurable

func (*Framework) NginxLogs

func (f *Framework) NginxLogs() (string, error)

NginxLogs returns the logs of the nginx ingress controller pod running

func (*Framework) WaitForNginxConfiguration

func (f *Framework) WaitForNginxConfiguration(matcher func(cfg string) bool) error

WaitForNginxConfiguration waits until the nginx configuration contains a particular configuration

func (*Framework) WaitForNginxServer

func (f *Framework) WaitForNginxServer(name string, matcher func(cfg string) bool) error

WaitForNginxServer waits until the nginx configuration contains a particular server section

func (*Framework) WaitForPodsReady

func (f *Framework) WaitForPodsReady(timeout time.Duration, expectedReplicas int, opts metav1.ListOptions) error

type RequestScheme

type RequestScheme string
const (
	HTTP  RequestScheme = "http"
	HTTPS RequestScheme = "https"
)

These are valid test request schemes.

type TestContextType

type TestContextType struct {
	KubeHost    string
	KubeConfig  string
	KubeContext string
}
var TestContext TestContextType

Jump to

Keyboard shortcuts

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