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 ¶
- func CreateEchoService(s *Sandbox, name string, annotations map[string]string) (*v1.Pod, *v1.Service, error)
- func CreateSecret(s *Sandbox, name string, data map[string][]byte) (*v1.Secret, error)
- func NewCloud(project string) (cloud.Cloud, error)
- func WaitForGCLBDeletion(ctx context.Context, c cloud.Cloud, g *fuzz.GCLB, ...) error
- func WaitForIngress(s *Sandbox, ing *v1beta1.Ingress) (*v1beta1.Ingress, error)
- func WaitForIngressDeletion(ctx context.Context, g *fuzz.GCLB, s *Sandbox, ing *v1beta1.Ingress, ...) error
- type Framework
- type Options
- type Sandbox
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 ¶
CreateSecret creates a secret from the given data.
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 ¶
WaitForIngress to stabilize.
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 ¶
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 ¶
RunWithSandbox runs the testFunc with the Sandbox, taking care of resource cleanup and isolation. This indirectly calls testing.T.Run().
func (*Framework) SanityCheck ¶
SanityCheck the test environment before proceeding.
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.