Documentation ¶
Index ¶
- Constants
- Variables
- func AfterReadingAllFlags(t *TestContextType)
- func CreateTestingNS(baseName string, c clientset.Interface, labels map[string]string) (*v1.Namespace, error)
- func DumpAllNamespaceInfo(c clientset.Interface, namespace string)
- func DumpEventsInNamespace(eventsLister EventsLister, namespace string)
- func ExpectNoError(err error, explain ...interface{})
- func ExpectNoErrorWithOffset(offset int, err error, explain ...interface{})
- func ExpectNoErrorWithRetries(fn func() error, maxRetries int, explain ...interface{})
- func HandleFlags()
- func LoadConfig() (*restclient.Config, error)
- func RandomSuffix() string
- func RegisterClusterFlags(flags *flag.FlagSet)
- func RegisterCommonFlags(flags *flag.FlagSet)
- func RemoveCleanupAction(p CleanupActionHandle)
- func RestclientConfig(kubeContext string) (*clientcmdapi.Config, error)
- func RunCleanupActions()
- func VCDescribe(text string, body func()) bool
- type CleanupActionHandle
- type EventsLister
- type Framework
- func (f *Framework) AddNamespacesToDelete(namespaces ...*v1.Namespace)
- func (f *Framework) AfterEach()
- func (f *Framework) BeforeEach()
- func (f *Framework) CreateNamespace(baseName string, labels map[string]string) (*v1.Namespace, error)
- func (f *Framework) VCClient() *VCClient
- func (f *Framework) WaitForVCNotFound(vcName string) error
- func (f *Framework) WaitForVCRunning(vcName string) error
- type Options
- type TestContextType
- type VCClient
Constants ¶
const ( // DefaultNamespaceDeletionTimeout is timeout duration for waiting for a namespace deletion. DefaultNamespaceDeletionTimeout = 10 * time.Minute )
const ( // Poll is how often to Poll pods, nodes and claims. Poll = 2 * time.Second )
Variables ¶
var RunID = uuid.NewUUID()
RunID is a unique identifier of the e2e run. Beware that this ID is not the same for all tests in the e2e run, because each Ginkgo node creates it separately.
Functions ¶
func AfterReadingAllFlags ¶
func AfterReadingAllFlags(t *TestContextType)
AfterReadingAllFlags makes changes to the context after all flags have been read.
func CreateTestingNS ¶
func CreateTestingNS(baseName string, c clientset.Interface, labels map[string]string) (*v1.Namespace, error)
CreateTestingNS should be used by every test, note that we append a common prefix to the provided test name. Please see NewFramework instead of using this directly.
func DumpAllNamespaceInfo ¶
DumpAllNamespaceInfo dumps events, pods and nodes information in the given namespace.
func DumpEventsInNamespace ¶
func DumpEventsInNamespace(eventsLister EventsLister, namespace string)
DumpEventsInNamespace dumps events in the given namespace.
func ExpectNoError ¶
func ExpectNoError(err error, explain ...interface{})
ExpectNoError checks if "err" is set
func ExpectNoErrorWithOffset ¶
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 ExpectNoErrorWithRetries ¶
ExpectNoErrorWithRetries checks if "err" is set with retries
func LoadConfig ¶
func LoadConfig() (*restclient.Config, error)
LoadConfig returns a config for a rest client.
func RandomSuffix ¶
func RandomSuffix() string
RandomSuffix provides a random string to append to pods,services,rcs.
func RegisterClusterFlags ¶
RegisterClusterFlags registers flags specific to the cluster e2e test suite.
func RegisterCommonFlags ¶
RegisterCommonFlags registers flags common to all e2e test suites. The flag set can be flag.CommandLine (if desired) or a custom flag set that then gets passed to viperconfig.ViperizeFlags.
The other Register*Flags methods below can be used to add more test-specific flags. However, those settings then get added regardless whether the test is actually in the test suite.
func RemoveCleanupAction ¶
func RemoveCleanupAction(p CleanupActionHandle)
RemoveCleanupAction removes a function that was installed by AddCleanupAction.
func RestclientConfig ¶
func RestclientConfig(kubeContext string) (*clientcmdapi.Config, error)
RestclientConfig returns a config holds the information needed to build connection to kubernetes clusters.
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 VCDescribe ¶
VCDescribe is wrapper function for ginkgo describe. Adds namespacing.
Types ¶
type CleanupActionHandle ¶
type CleanupActionHandle *int
CleanupActionHandle is an integer pointer type for handling cleanup action
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 ¶
EventsLister is a func that lists events.
type Framework ¶
type Framework struct { BaseName string // Set together with creating the ClientSet and the namespace. // Guaranteed to be unique in the cluster even when running the same // test multiple times in parallel. UniqueName string ClientSet clientset.Interface VCClientSet vcclient.Interface DynamicClient dynamic.Interface Namespace *v1.Namespace // Every test has at least one namespace. NamespaceDeletionTimeout time.Duration // configuration for framework's client Options Options // contains filtered or unexported fields }
Framework supports common operations used by e2e tests; it will keep a client & a namespace for you. Eventual goal is to merge this with integration test framework.
func NewDefaultFramework ¶
NewDefaultFramework makes a new framework and sets up a BeforeEach/AfterEach for you (you can write additional before/after each functions).
func NewFramework ¶
NewFramework creates a test framework.
func (*Framework) AddNamespacesToDelete ¶
AddNamespacesToDelete adds one or more namespaces to be deleted when the test completes.
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) CreateNamespace ¶
func (f *Framework) CreateNamespace(baseName string, labels map[string]string) (*v1.Namespace, error)
CreateNamespace creates a namespace for e2e testing.
func (*Framework) VCClient ¶
VCClient is a convenience method for getting a vc client interface in the framework's namespace, possibly applying test-suite specific transformations to the vc spec.
func (*Framework) WaitForVCNotFound ¶
WaitForVCRunning waits for the vc to be deleted in the namespace.
func (*Framework) WaitForVCRunning ¶
WaitForVCRunning waits for the vc to run in the namespace.
type Options ¶
type Options struct { ClientQPS float32 ClientBurst int GroupVersion *schema.GroupVersion }
Options is a struct for managing test framework options.
type TestContextType ¶
type TestContextType struct { KubeConfig string KubeContext string Host string ReportDir string ReportPrefix string DeleteNamespace bool DeleteNamespaceOnFailure bool // If set to true test will dump data about the namespace in which test was running. DumpLogsOnFailure bool }
TestContextType contains test settings and global state.
var TestContext TestContextType
TestContext should be used by all tests to access common context data.
type VCClient ¶
type VCClient struct { Interface clientset.Interface tenancyv1alpha1.VirtualClusterInterface // contains filtered or unexported fields }
VCClient is a struct for vc client.
func (*VCClient) CreateSync ¶
func (c *VCClient) CreateSync(vc *v1alpha1.VirtualCluster) *v1alpha1.VirtualCluster
CreateSync creates a new vc according to the framework specifications, and wait for it to start.
func (*VCClient) DeleteSync ¶
func (c *VCClient) DeleteSync(name string, options *metav1.DeleteOptions)
DeleteSync deletes the vc and wait for the vc to disappear.
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. |