framework

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2019 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// How often to poll for conditions
	Poll = 2 * time.Second
)

Variables

View Source
var DefaultConfig = &config.Config{}

DefaultConfig contains the default shared config the is likely parsed from command line arguments.

View Source
var Scheme = runtime.NewScheme()

TODO: this really should be done somewhere in cert-manager proper

Functions

func CertManagerDescribe

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

CertManagerDescribe is a wrapper function for ginkgo describe. Adds namespacing.

func ConformanceDescribe

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

func Failf

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

func RbacClusterRoleHasAccessToResource

func RbacClusterRoleHasAccessToResource(f *Framework, clusterRole string, verb string, resource string) bool

TODO: move this function into a different package

func RemoveCleanupAction

func RemoveCleanupAction(p CleanupActionHandle)

RemoveCleanupAction removes a function that was installed by AddCleanupAction.

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

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 Framework

type Framework struct {
	BaseName string

	Config *config.Config

	// KubeClientConfig which was used to create the connection.
	KubeClientConfig *rest.Config

	// Kubernetes API clientsets
	KubeClientSet          kubernetes.Interface
	CertManagerClientSet   clientset.Interface
	APIExtensionsClientSet apiextcs.Interface

	// controller-runtime client for newer controllers
	CRClient crclient.Client

	// Namespace in which all test resources should reside
	Namespace *v1.Namespace
	// 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 for you, similar to NewFramework. It uses the suite-wide 'DefaultConfig' which should be populated by the testing harness in test/e2e/e2e_test.go

func NewFramework

func NewFramework(baseName string, cfg *config.Config) *Framework

NewFramework makes a new framework and sets up a BeforeEach/AfterEach for you (you can write additional before/after each functions). It uses the config provided to it for the duration of the tests.

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) CertificateDurationValid added in v0.6.0

func (f *Framework) CertificateDurationValid(c *v1alpha1.Certificate, duration time.Duration)

func (*Framework) CreateKubeNamespace

func (f *Framework) CreateKubeNamespace(baseName string) (*v1.Namespace, error)

CreateKubeNamespace creates a new Kubernetes Namespace for a test.

func (*Framework) CreateKubeResourceQuota

func (f *Framework) CreateKubeResourceQuota() (*v1.ResourceQuota, error)

CreateKubeResourceQuota provisions a ResourceQuota resource in the target namespace.

func (*Framework) DeleteKubeNamespace

func (f *Framework) DeleteKubeNamespace(namespace string) error

DeleteKubeNamespace will delete a namespace resource

func (*Framework) Helper

func (f *Framework) Helper() *helper.Helper

func (*Framework) RequireAddon

func (f *Framework) RequireAddon(a addon.Addon)

RequireAddon calls the Setup and Provision method on the given addon, failing the spec if provisioning fails.

func (*Framework) RequireGlobalAddon

func (f *Framework) RequireGlobalAddon(a addon.Addon)

RequireGlobalAddon calls Setup on the given addon. This should be called in specs or describe blocks that require access to any of the global/shared addons in order to ensure their details are available. This method should only ever be called with addons defined in the 'addons' that are present in the 'globals' variable, as they will not be Provisioned properly otherwise.

func (*Framework) WaitForKubeNamespaceNotExist

func (f *Framework) WaitForKubeNamespaceNotExist(namespace string) error

WaitForKubeNamespaceNotExist will wait for the namespace with the given name to not exist for up to 2 minutes.

Directories

Path Synopsis
base
Package base implements a basis for plugins that need to use the Kubernetes API to build upon.
Package base implements a basis for plugins that need to use the Kubernetes API to build upon.
nginxingress
package nginx contains an addon that installs nginx-ingress
package nginx contains an addon that installs nginx-ingress
pebble
package Pebble contains an addon that installs Pebble
package Pebble contains an addon that installs Pebble
vault
package vault contains an addon that installs Vault
package vault contains an addon that installs Vault
errors
Package errors contains shared error types that tests and addons can depend upon to communicate information about why something has failed
Package errors contains shared error types that tests and addons can depend upon to communicate information about why something has failed

Jump to

Keyboard shortcuts

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