framework

package
v0.0.1-test-fake Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2018 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// How long to try single API calls (like 'get' or 'list'). Used to prevent
	// transient failures from failing tests.
	PollInterval      = 2 * time.Second
	SingleCallTimeout = 30 * time.Second
)

Variables

View Source
var RunId = uuid.NewUUID()

unique identifier of the e2e run

Functions

func ClusterIsReadyOrFail

func ClusterIsReadyOrFail(client fedclientset.Interface, cluster *fedv1a1.FederatedCluster)

ClusterIsReadyOrFail checks whether the named cluster has been marked as ready by the federated cluster controller. The cluster controller records the results of health checks on member clusters in the status of federated clusters.

func DumpEventsInNamespace

func DumpEventsInNamespace(eventsLister EventsLister, namespace string)

func Errorf

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

func ExpectNoError

func ExpectNoError(err error, explain ...interface{})

func ExpectNoErrorWithOffset

func ExpectNoErrorWithOffset(offset int, err error, explain ...interface{})

ExpectNoErrorWithOffset checks if "err" is set, and if so, fails assertion while logging the error at "offset" levels above its caller (for example, for call chain f -> g -> ExpectNoErrorWithOffset(1, ...) error would be logged for "f").

func Failf

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

func FailfWithOffset

func FailfWithOffset(offset int, format string, args ...interface{})

FailfWithOffset calls "Fail" and logs the error at "offset" levels above its caller (for example, for call chain f -> g -> FailfWithOffset(1, ...) error would be logged for "f").

func Logf

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

func NewE2ELogger

func NewE2ELogger() common.TestLogger

func ParseFlags

func ParseFlags()

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 SetUpManagedFederation

func SetUpManagedFederation()

func SetUpUnmanagedFederation

func SetUpUnmanagedFederation()

func Skipf

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

func TearDownManagedFederation

func TearDownManagedFederation()

func TearDownUnmanagedFederation

func TearDownUnmanagedFederation()

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 EventsLister

type EventsLister func(opts metav1.ListOptions, ns string) (*corev1.EventList, error)

type FederationFramework

type FederationFramework interface {
	BeforeEach()
	AfterEach()

	KubeConfig() *restclient.Config

	KubeClient(userAgent string) kubeclientset.Interface
	FedClient(userAgent string) fedclientset.Interface
	CrClient(userAgent string) crclientset.Interface

	ClusterDynamicClients(apiResource *metav1.APIResource, userAgent string) map[string]common.TestCluster
	ClusterKubeClients(userAgent string) map[string]kubeclientset.Interface

	// Name of the namespace for the current test to target
	TestNamespaceName() string

	// Initialize and cleanup in-memory controller (useful for debugging)
	SetUpControllerFixture(typeConfig typeconfig.Interface)

	SetUpServiceDNSControllerFixture()
}

FederationFramework provides an interface to a test federation so that the implementation can vary without affecting tests.

func NewFederationFramework

func NewFederationFramework(baseName string) FederationFramework

func NewManagedFramework

func NewManagedFramework(baseName string) FederationFramework

func NewUnmanagedFramework

func NewUnmanagedFramework(baseName string) FederationFramework

type ManagedFramework

type ManagedFramework struct {
	// contains filtered or unexported fields
}

func (*ManagedFramework) AfterEach

func (f *ManagedFramework) AfterEach()

func (*ManagedFramework) BeforeEach

func (f *ManagedFramework) BeforeEach()

func (*ManagedFramework) ClusterDynamicClients

func (f *ManagedFramework) ClusterDynamicClients(apiResource *metav1.APIResource, userAgent string) map[string]common.TestCluster

func (*ManagedFramework) ClusterKubeClients

func (f *ManagedFramework) ClusterKubeClients(userAgent string) map[string]kubeclientset.Interface

func (*ManagedFramework) CrClient

func (f *ManagedFramework) CrClient(userAgent string) crclientset.Interface

func (*ManagedFramework) FedClient

func (f *ManagedFramework) FedClient(userAgent string) fedclientset.Interface

func (*ManagedFramework) KubeClient

func (f *ManagedFramework) KubeClient(userAgent string) kubeclientset.Interface

func (*ManagedFramework) KubeConfig

func (f *ManagedFramework) KubeConfig() *restclient.Config

func (*ManagedFramework) SetUpControllerFixture

func (f *ManagedFramework) SetUpControllerFixture(typeConfig typeconfig.Interface)

func (*ManagedFramework) SetUpServiceDNSControllerFixture

func (f *ManagedFramework) SetUpServiceDNSControllerFixture()

func (*ManagedFramework) TestNamespaceName

func (f *ManagedFramework) TestNamespaceName() string

TODO(marun) remove

type TestContextType

type TestContextType struct {
	TestManagedFederation bool
	InMemoryControllers   bool
	KubeConfig            string
	KubeContext           string
}
var TestContext TestContextType

type UnmanagedFramework

type UnmanagedFramework struct {
	Config     *restclient.Config
	Kubeconfig *clientcmdapi.Config

	BaseName string
	// contains filtered or unexported fields
}

func (*UnmanagedFramework) AfterEach

func (f *UnmanagedFramework) AfterEach()

AfterEach deletes the namespace, after reading its events.

func (*UnmanagedFramework) BeforeEach

func (f *UnmanagedFramework) BeforeEach()

BeforeEach checks for federation apiserver is ready and makes a namespace.

func (*UnmanagedFramework) ClusterConfigs

func (f *UnmanagedFramework) ClusterConfigs(userAgent string) map[string]*restclient.Config

func (*UnmanagedFramework) ClusterDynamicClients

func (f *UnmanagedFramework) ClusterDynamicClients(apiResource *metav1.APIResource, userAgent string) map[string]common.TestCluster

func (*UnmanagedFramework) ClusterKubeClients

func (f *UnmanagedFramework) ClusterKubeClients(userAgent string) map[string]kubeclientset.Interface

func (*UnmanagedFramework) CrClient

func (f *UnmanagedFramework) CrClient(userAgent string) crclientset.Interface

func (*UnmanagedFramework) FedClient

func (f *UnmanagedFramework) FedClient(userAgent string) fedclientset.Interface

func (*UnmanagedFramework) KubeClient

func (f *UnmanagedFramework) KubeClient(userAgent string) kubeclientset.Interface

func (*UnmanagedFramework) KubeConfig

func (f *UnmanagedFramework) KubeConfig() *restclient.Config

func (*UnmanagedFramework) SetUpControllerFixture

func (f *UnmanagedFramework) SetUpControllerFixture(typeConfig typeconfig.Interface)

func (*UnmanagedFramework) SetUpServiceDNSControllerFixture

func (f *UnmanagedFramework) SetUpServiceDNSControllerFixture()

func (*UnmanagedFramework) TestNamespaceName

func (f *UnmanagedFramework) TestNamespaceName() string

TODO(marun) remove

Directories

Path Synopsis
Package ginkgowrapper wraps Ginkgo Fail and Skip functions to panic with structured data instead of a constant string.
Package ginkgowrapper wraps Ginkgo Fail and Skip functions to panic with structured data instead of a constant string.

Jump to

Keyboard shortcuts

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