e2e

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package e2e contains supporting infrastructure for end-to-end integration testing driven by the tests in cmd/e2e-test.

Test should be written with a Sandbox:

func TestExample(t *testing.T) {
  for _, tc := range []struct{
    ...
  }{
    ...
  }{
    tc := tc // avoid variable capture
    Framework.RunWithSandbox(t, func(t *testing.T, s *e2e.Sandbox) {
      t.Parallel()
      // Test code...
    })
  }
}

The Sandbox will handle resource isolation and reclaimation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEchoService

func CreateEchoService(s *Sandbox, name string, annotations map[string]string) (*v1.Pod, *v1.Service, error)

CreateEchoService creates the pod and service serving echoheaders.

func CreateSecret

func CreateSecret(s *Sandbox, name string, data map[string][]byte) (*v1.Secret, error)

CreateSecret creates a secret from the given data.

func NewCloud

func NewCloud(project string) (cloud.Cloud, error)

NewCloud creates a new cloud for the given project.

func WaitForGCLBDeletion

func WaitForGCLBDeletion(ctx context.Context, c cloud.Cloud, g *fuzz.GCLB, options *fuzz.GCLBDeleteOptions) error

WaitForGCLBDeletion waits for the resources associated with the GLBC to be deleted.

func WaitForIngress

func WaitForIngress(s *Sandbox, ing *v1beta1.Ingress) (*v1beta1.Ingress, error)

WaitForIngress to stabilize.

func WaitForIngressDeletion

func WaitForIngressDeletion(ctx context.Context, g *fuzz.GCLB, s *Sandbox, ing *v1beta1.Ingress, options *fuzz.GCLBDeleteOptions) error

WaitForIngressDeletion deletes the given ingress and waits for the resources associated with it to be deleted.

Types

type Framework

type Framework struct {
	RestConfig          *rest.Config
	Clientset           *kubernetes.Clientset
	BackendConfigClient *backendconfigclient.Clientset
	Project             string
	Cloud               cloud.Cloud
	Rand                *rand.Rand
	// contains filtered or unexported fields
}

Framework is the end-to-end test framework.

func NewFramework

func NewFramework(config *rest.Config, options Options) *Framework

NewFramework returns a new test framework to run.

func (*Framework) CatchSIGINT

func (f *Framework) CatchSIGINT()

CatchSIGINT and cleanup sandboxes when the test is interrupted.

func (*Framework) RunWithSandbox

func (f *Framework) RunWithSandbox(name string, t *testing.T, testFunc func(*testing.T, *Sandbox))

RunWithSandbox runs the testFunc with the Sandbox, taking care of resource cleanup and isolation. This indirectly calls testing.T.Run().

func (*Framework) SanityCheck

func (f *Framework) SanityCheck() error

SanityCheck the test environment before proceeding.

func (*Framework) WithSandbox

func (f *Framework) WithSandbox(testFunc func(*Sandbox) error) error

WithSandbox runs the testFunc with the Sandbox, taking care of resource cleanup and isolation.

type Options

type Options struct {
	Project          string
	Seed             int64
	DestroySandboxes bool
}

Options for the test framework.

type Sandbox

type Sandbox struct {
	// Namespace to create resources in. Resources created in this namespace
	// will be deleted with Destroy().
	Namespace string
	// ValidatorEnv for use with the test.
	ValidatorEnv fuzz.ValidatorEnv
	// contains filtered or unexported fields
}

Sandbox represents a sandbox for running tests in a Kubernetes cluster.

func (*Sandbox) Create

func (s *Sandbox) Create() error

Create the sandbox.

func (*Sandbox) Destroy

func (s *Sandbox) Destroy()

Destroy the sandbox and all resources associated with the sandbox.

Jump to

Keyboard shortcuts

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