Documentation
¶
Index ¶
- Constants
- Variables
- func AfterReadingAllFlags(t *TestContextType)
- func AllNodesReady(c clientset.Interface, timeout time.Duration) error
- func ConformanceIt(text string, body interface{}, timeout ...float64) bool
- func CreateTestingNS(baseName string, c clientset.Interface, labels map[string]string) (*corev1.Namespace, error)
- func DumpAllNamespaceInfo(c clientset.Interface, namespace string)
- func DumpDebugInfo(c clientset.Interface, ns string)
- func DumpEventsInNamespace(eventsLister EventsLister, namespace string)
- func ExpectEqual(actual, extra interface{}, explain ...interface{})
- func ExpectNoError(err error, explain ...interface{})
- func ExpectNoErrorWithOffset(offset int, err error, explain ...interface{})
- func ExpectNoErrorWithRetries(fn func() error, maxRetries int, explain ...interface{})
- func Fail(message string, callerSkip ...int)
- func Failf(format string, args ...interface{})
- func FailfWithOffset(offset int, format string, args ...interface{})
- func FilterNodes(nodeList *corev1.NodeList, fn func(node corev1.Node) bool)
- func GetReadySchedulableNodesOrDie(c clientset.Interface) (nodes *corev1.NodeList)
- func IsNodeConditionSetAsExpected(node *corev1.Node, conditionType corev1.NodeConditionType, wantTrue bool) bool
- func IsNodeConditionSetAsExpectedSilent(node *corev1.Node, conditionType corev1.NodeConditionType, wantTrue bool) bool
- func IsNodeConditionUnset(node *corev1.Node, conditionType corev1.NodeConditionType) bool
- func KoribtoDescribe(text string, body func()) bool
- func KubectlCmd(args ...string) *exec.Cmd
- func KusionstackDescribe(text string, body func()) bool
- func LoadClientset() (*clientset.Clientset, error)
- func LoadConfig() (*restclient.Config, error)
- func Logf(format string, args ...interface{})
- func RandStr() string
- func RegisterClusterFlags(flags *flag.FlagSet)
- func RegisterCommonFlags(flags *flag.FlagSet)
- func RegisterNodeFlags()
- func RegisterProvider(name string, factory Factory)
- func RemoveCleanupAction(p CleanupActionHandle)
- func RestclientConfig(kubeContext string) (*clientcmdapi.Config, error)
- func RunCleanupActions()
- func RunHostCmd(ns, name, cmd string) (string, error)
- func RunHostCmdWithRetries(ns, name, cmd string, interval, timeout time.Duration) (string, error)
- func RunKubectl(args ...string) (string, error)
- func RunKubectlOrDie(args ...string) string
- func WaitForDefaultServiceAccountInNamespace(c clientset.Interface, namespace string) error
- func WaitForPodCondition(c clientset.Interface, ns, podName, desc string, timeout time.Duration, ...) error
- func WaitForPodNameRunningInNamespace(c clientset.Interface, podName, namespace string) error
- func WaitForPodRunningInNamespace(c clientset.Interface, pod *corev1.Pod) error
- func WaitTimeoutForPodRunningInNamespace(c clientset.Interface, podName, namespace string, timeout time.Duration) error
- type CleanupActionHandle
- type ClientConfigGetter
- type CloudConfig
- type CodeExitError
- type CollaSetTester
- func (t *CollaSetTester) CreateCollaSet(cls *appsv1alpha1.CollaSet) error
- func (t *CollaSetTester) DeleteAllCollaSet(namespace string) error
- func (t *CollaSetTester) DeleteCollaSet(cls *appsv1alpha1.CollaSet) error
- func (t *CollaSetTester) ExpectedStatusReplicas(cls *appsv1alpha1.CollaSet, ...) error
- func (t *CollaSetTester) GetAllCollaSet(namespace string) (clsList *appsv1alpha1.CollaSetList, err error)
- func (t *CollaSetTester) GetCollaSet(cls *appsv1alpha1.CollaSet) error
- func (t *CollaSetTester) ListPVCForCollaSet(cls *appsv1alpha1.CollaSet) (pvcs []*v1.PersistentVolumeClaim, err error)
- func (t *CollaSetTester) ListPodsForCollaSet(cls *appsv1alpha1.CollaSet) (pods []*v1.Pod, err error)
- func (t *CollaSetTester) ListResourceContextsForCollaSet(cls *appsv1alpha1.CollaSet) (resourceContexts []*appsv1alpha1.ResourceContext, err error)
- func (t *CollaSetTester) NewCollaSet(name string, replicas int32, updateStrategy appsv1alpha1.UpdateStrategy) *appsv1alpha1.CollaSet
- func (t *CollaSetTester) UpdateCollaSet(cls *appsv1alpha1.CollaSet, fn func(cls *appsv1alpha1.CollaSet)) error
- func (t *CollaSetTester) UpdatePod(pod *v1.Pod, fn func(pod *v1.Pod)) error
- func (t *CollaSetTester) UpdatePvc(pvc *v1.PersistentVolumeClaim, fn func(pvc *v1.PersistentVolumeClaim)) error
- type CreateTestingNSFn
- type DumpAllNamespaceInfoAction
- type EventsLister
- type ExitError
- type Factory
- type FailurePanic
- type Framework
- func (f *Framework) AddNamespacesToDelete(namespaces ...*corev1.Namespace)
- func (f *Framework) AfterEach()
- func (f *Framework) BeforeEach()
- func (f *Framework) CreateNamespace(baseName string, labels map[string]string) (*corev1.Namespace, error)
- func (f *Framework) WaitForPodRunning(podName string) error
- type KubectlBuilder
- func (b KubectlBuilder) Exec() (string, error)
- func (b KubectlBuilder) ExecOrDie() string
- func (b *KubectlBuilder) WithEnv(env []string) *KubectlBuilder
- func (b KubectlBuilder) WithStdinData(data string) *KubectlBuilder
- func (b KubectlBuilder) WithStdinReader(reader io.Reader) *KubectlBuilder
- func (b *KubectlBuilder) WithTimeout(t <-chan time.Time) *KubectlBuilder
- type NodeTestContextType
- type NullProvider
- func (n NullProvider) CleanupServiceResources(c clientset.Interface, loadBalancerName, region, zone string)
- func (n NullProvider) CreatePD(zone string) (string, error)
- func (n NullProvider) CreatePVSource(zone, diskName string) (*corev1.PersistentVolumeSource, error)
- func (n NullProvider) DeletePD(pdName string) error
- func (n NullProvider) DeletePVSource(pvSource *corev1.PersistentVolumeSource) error
- func (n NullProvider) EnableAndDisableInternalLB() (enable, disable func(svc *corev1.Service))
- func (n NullProvider) EnsureLoadBalancerResourcesDeleted(ip, portRange string) error
- func (n NullProvider) FrameworkAfterEach(f *Framework)
- func (n NullProvider) FrameworkBeforeEach(f *Framework)
- func (n NullProvider) GetGroupNodes(group string) ([]string, error)
- func (n NullProvider) GroupSize(group string) (int, error)
- func (n NullProvider) LoadBalancerSrcRanges() []string
- func (n NullProvider) ResizeGroup(string, int32) error
- type OperationJobTester
- func (t *OperationJobTester) CreateOperationJob(oj *appsv1alpha1.OperationJob) error
- func (t *OperationJobTester) DeleteOperationJob(oj *appsv1alpha1.OperationJob) error
- func (t *OperationJobTester) ExpectOperationJobProgress(oj *appsv1alpha1.OperationJob, progress appsv1alpha1.OperationProgress) error
- func (t *OperationJobTester) GetOperationJob(oj *appsv1alpha1.OperationJob) error
- func (t *OperationJobTester) ListPodsForOperationJobTester(oj *appsv1alpha1.OperationJob) (pods []*v1.Pod, err error)
- func (t *OperationJobTester) NewOperationJob(name, action string, targets []appsv1alpha1.PodOpsTarget) *appsv1alpha1.OperationJob
- func (t *OperationJobTester) UpdateOperationJob(oj *appsv1alpha1.OperationJob, fn func(oj *appsv1alpha1.OperationJob)) error
- func (t *OperationJobTester) UpdatePod(pod *v1.Pod, fn func(pod *v1.Pod)) error
- type Options
- type ProviderInterface
- type TestContextType
- type TestDataSummary
Constants ¶
const ( // PodStartTimeout indicates that initial pod start can be delayed O(minutes) by slow docker pulls // TODO: Make this 30 seconds once #4566 is resolved. PodStartTimeout = 5 * time.Minute // Poll indicates how often to Poll pods, nodes and claims. Poll = 2 * time.Second // ServiceAccountProvisionTimeout indicates a service account provision timeout. // service accounts are provisioned after namespace creation // a service account is required to support pod creation in a namespace as part of admission control ServiceAccountProvisionTimeout = 2 * time.Minute // SingleCallTimeout indicates how long to try single API calls (like 'get' or 'list'). Used to prevent // transient failures from failing tests. // TODO: client should not apply this timeout to Watch calls. Increased from 30s until that is fixed. SingleCallTimeout = 5 * time.Minute )
const ( // DefaultNamespaceDeletionTimeout is timeout duration for waiting for a namespace deletion. DefaultNamespaceDeletionTimeout = 5 * time.Minute )
Variables ¶
var ( // UnreachableTaintTemplate is the taint for when a node becomes unreachable. UnreachableTaintTemplate = &corev1.Taint{ Key: corev1.TaintNodeUnreachable, Effect: corev1.TaintEffectNoExecute, } // NotReadyTaintTemplate is the taint for when a node doesn't ready. NotReadyTaintTemplate = &corev1.Taint{ Key: corev1.TaintNodeNotReady, Effect: corev1.TaintEffectNoExecute, } )
var ErrPodCompleted = fmt.Errorf("pod ran to completion")
var NewFrameworkExtensions []func(f *Framework)
NewFrameworkExtensions lists functions that get called by NewFramework after constructing a new framework and after calling ginkgo.BeforeEach for the framework.
This can be used by extensions of the core framework to modify settings in the framework instance or to add additional callbacks with gingko.BeforeEach/AfterEach/DeferCleanup.
When a test runs, functions will be invoked in this order:
- BeforeEaches defined by tests before f.NewDefaultFramework in the order in which they were defined (first-in-first-out)
- f.BeforeEach
- BeforeEaches defined by tests after f.NewDefaultFramework
- It callback
- all AfterEaches in the order in which they were defined
- all DeferCleanups with the order reversed (first-in-last-out)
- f.AfterEach
Because a test might skip test execution in a BeforeEach that runs before f.BeforeEach, AfterEach callbacks that depend on the framework instance must check whether it was initialized. They can do that by checking f.ClientSet for nil. DeferCleanup callbacks don't need to do this because they get defined when the test runs.
var RunID = uuid.NewUUID()
RunID is a unique identifier of the e2e run
Functions ¶
func AfterReadingAllFlags ¶
func AfterReadingAllFlags(t *TestContextType)
AfterReadingAllFlags makes changes to the context after all flags have been read.
func AllNodesReady ¶
AllNodesReady checks whether all registered nodes are ready. TODO: we should change the AllNodesReady call in AfterEach to WaitForAllNodesHealthy, and figure out how to do it in a configurable way, as we can't expect all setups to run default test add-ons.
func ConformanceIt ¶
ConformanceIt is a wrapper function for ginkgo It. Adds "[Conformance]" tag and makes static analysis easier.
func CreateTestingNS ¶
func CreateTestingNS(baseName string, c clientset.Interface, labels map[string]string) (*corev1.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 is used to dump all namespace info
func DumpDebugInfo ¶
DumpDebugInfo dumps debug info
func DumpEventsInNamespace ¶
func DumpEventsInNamespace(eventsLister EventsLister, namespace string)
DumpEventsInNamespace dump events in namespace
func ExpectEqual ¶
func ExpectEqual(actual, extra interface{}, explain ...interface{})
ExpectEqual expects the specified two are the same, otherwise an exception raises
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 Fail ¶
Fail wraps ginkgo.Fail so that it panics with more useful information about the failure. This function will panic with a FailurePanic.
func FailfWithOffset ¶
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 FilterNodes ¶
FilterNodes filters nodes in NodeList in place, removing nodes that do not satisfy the given condition TODO: consider merging with pkg/client/cache.NodeLister
func GetReadySchedulableNodesOrDie ¶
GetReadySchedulableNodesOrDie addresses the common use case of getting nodes you can do work on. 1) Needs to be schedulable. 2) Needs to be ready. If EITHER 1 or 2 is not true, most tests will want to ignore the node entirely.
func IsNodeConditionSetAsExpected ¶
func IsNodeConditionSetAsExpected(node *corev1.Node, conditionType corev1.NodeConditionType, wantTrue bool) bool
IsNodeConditionSetAsExpected indicate if node is ready
func IsNodeConditionSetAsExpectedSilent ¶
func IsNodeConditionSetAsExpectedSilent(node *corev1.Node, conditionType corev1.NodeConditionType, wantTrue bool) bool
IsNodeConditionSetAsExpectedSilent indicate if node is ready with silent
func IsNodeConditionUnset ¶
func IsNodeConditionUnset(node *corev1.Node, conditionType corev1.NodeConditionType) bool
IsNodeConditionUnset indicate if set condition
func KoribtoDescribe ¶
KoribtoDescribe is a wrapper function for ginkgo describe.
func KubectlCmd ¶
KubectlCmd runs the kubectl executable through the wrapper script.
func KusionstackDescribe ¶
KusionstackDescribe is a wrapper for ginkgo.Describe.
func LoadClientset ¶
LoadClientset loads config of client set
func RegisterClusterFlags ¶
RegisterClusterFlags registers flags specific to the cluster e2e test suite.
func RegisterCommonFlags ¶
RegisterCommonFlags registers flags common to all e2e test suites.
func RegisterNodeFlags ¶
func RegisterNodeFlags()
RegisterNodeFlags registers flags specific to the node e2e test suite.
func RegisterProvider ¶
RegisterProvider is expected to be called during application init, typically by an init function in a provider package.
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 loads config
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 RunHostCmd ¶
RunHostCmd runs the given cmd in the context of the given pod using `kubectl exec` inside of a shell.
func RunHostCmdWithRetries ¶
RunHostCmdWithRetries calls RunHostCmd and retries all errors until it succeeds or the specified timeout expires. This can be used with idempotent commands to deflake transient Node issues.
func RunKubectl ¶
RunKubectl is a convenience wrapper over KubectlBuilder
func RunKubectlOrDie ¶
RunKubectlOrDie is a convenience wrapper over KubectlBuilder
func WaitForDefaultServiceAccountInNamespace ¶
WaitForDefaultServiceAccountInNamespace waits for the default service account to be provisioned the default service account is what is associated with pods when they do not specify a service account as a result, pods are not able to be provisioned in a namespace until the service account is provisioned
func WaitForPodCondition ¶
func WaitForPodCondition(c clientset.Interface, ns, podName, desc string, timeout time.Duration, condition podCondition) error
WaitForPodCondition waits until pod satisfied condition
func WaitForPodNameRunningInNamespace ¶
WaitForPodNameRunningInNamespace waits default amount of time (PodStartTimeout) for the specified pod to become running. Returns an error if timeout occurs first, or pod goes in to failed state.
func WaitForPodRunningInNamespace ¶
WaitForPodRunningInNamespace waits default amount of time (PodStartTimeout) for the specified pod to become running. Returns an error if timeout occurs first, or pod goes in to failed state.
Types ¶
type CleanupActionHandle ¶
type CleanupActionHandle *int
CleanupActionHandle defines a type for cleanup action handle
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 ClientConfigGetter ¶
type ClientConfigGetter func() (*restclient.Config, error)
ClientConfigGetter gets client config
type CloudConfig ¶
type CloudConfig struct {
APIEndpoint string
ProjectID string
Zone string // for multizone tests, arbitrarily chosen zone
Region string
MultiZone bool
MultiMaster bool
Cluster string
MasterName string
NodeInstanceGroup string // comma-delimited list of groups' names
NumNodes int
ClusterIPRange string
ClusterTag string
Network string
ConfigFile string // for azure and openstack
NodeTag string
MasterTag string
Provider ProviderInterface
}
CloudConfig defines some config
type CodeExitError ¶
func (CodeExitError) Error ¶
func (e CodeExitError) Error() string
func (CodeExitError) ExitStatus ¶
func (e CodeExitError) ExitStatus() int
ExitStatus is for checking the error code
func (CodeExitError) Exited ¶
func (e CodeExitError) Exited() bool
Exited is to check if the process has finished
func (CodeExitError) String ¶
func (e CodeExitError) String() string
type CollaSetTester ¶
type CollaSetTester struct {
// contains filtered or unexported fields
}
func NewCollaSetTester ¶
func (*CollaSetTester) CreateCollaSet ¶
func (t *CollaSetTester) CreateCollaSet(cls *appsv1alpha1.CollaSet) error
func (*CollaSetTester) DeleteAllCollaSet ¶ added in v0.7.2
func (t *CollaSetTester) DeleteAllCollaSet(namespace string) error
func (*CollaSetTester) DeleteCollaSet ¶
func (t *CollaSetTester) DeleteCollaSet(cls *appsv1alpha1.CollaSet) error
func (*CollaSetTester) ExpectedStatusReplicas ¶
func (t *CollaSetTester) ExpectedStatusReplicas(cls *appsv1alpha1.CollaSet, replicas, readyReplicas, availableReplicas, updatedReplicas, totalReplicas int32) error
func (*CollaSetTester) GetAllCollaSet ¶ added in v0.7.2
func (t *CollaSetTester) GetAllCollaSet(namespace string) (clsList *appsv1alpha1.CollaSetList, err error)
func (*CollaSetTester) GetCollaSet ¶
func (t *CollaSetTester) GetCollaSet(cls *appsv1alpha1.CollaSet) error
func (*CollaSetTester) ListPVCForCollaSet ¶
func (t *CollaSetTester) ListPVCForCollaSet(cls *appsv1alpha1.CollaSet) (pvcs []*v1.PersistentVolumeClaim, err error)
func (*CollaSetTester) ListPodsForCollaSet ¶
func (t *CollaSetTester) ListPodsForCollaSet(cls *appsv1alpha1.CollaSet) (pods []*v1.Pod, err error)
func (*CollaSetTester) ListResourceContextsForCollaSet ¶
func (t *CollaSetTester) ListResourceContextsForCollaSet(cls *appsv1alpha1.CollaSet) (resourceContexts []*appsv1alpha1.ResourceContext, err error)
func (*CollaSetTester) NewCollaSet ¶
func (t *CollaSetTester) NewCollaSet(name string, replicas int32, updateStrategy appsv1alpha1.UpdateStrategy) *appsv1alpha1.CollaSet
func (*CollaSetTester) UpdateCollaSet ¶
func (t *CollaSetTester) UpdateCollaSet(cls *appsv1alpha1.CollaSet, fn func(cls *appsv1alpha1.CollaSet)) error
func (*CollaSetTester) UpdatePvc ¶ added in v0.6.1
func (t *CollaSetTester) UpdatePvc(pvc *v1.PersistentVolumeClaim, fn func(pvc *v1.PersistentVolumeClaim)) error
type CreateTestingNSFn ¶
type CreateTestingNSFn func(baseName string, c clientset.Interface, labels map[string]string) (*corev1.Namespace, error)
CreateTestingNSFn defines a function to create test
type DumpAllNamespaceInfoAction ¶
DumpAllNamespaceInfoAction is called after each failed test for namespaces created for the test.
type EventsLister ¶
EventsLister defines a event listener
type Factory ¶
type Factory func() (ProviderInterface, error)
Factory represents the factory pattern
type FailurePanic ¶
type FailurePanic struct {
Message string // The failure message passed to Fail
Filename string // The filename that is the source of the failure
Line int // The line number of the filename that is the source of the failure
FullStackTrace string // A full stack trace starting at the source of the failure
}
FailurePanic is the value that will be panicked from Fail.
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
Client client.Client
ClientSet clientset.Interface
DynamicClient dynamic.Interface
SkipNamespaceCreation bool // Whether to skip creating a namespace
Namespace *corev1.Namespace // Every test has at least one namespace unless creation is skipped
NamespaceDeletionTimeout time.Duration
SkipPrivilegedPSPBinding bool // Whether to skip creating a binding to the privileged PSP in the test namespace
// configuration for framework's client
Options Options
// Place where various additional data is stored during test run to be printed to ReportDir,
// or stdout if ReportDir is not set once test ends.
TestSummaries []TestDataSummary
AfterEachActions []func()
// 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 makes a new framework and sets up a BeforeEach/AfterEach
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) (*corev1.Namespace, error)
CreateNamespace is used to create namespace
func (*Framework) WaitForPodRunning ¶
WaitForPodRunning waits for the pod to run in the namespace.
type KubectlBuilder ¶
type KubectlBuilder struct {
// contains filtered or unexported fields
}
KubectlBuilder is used to build, customize and execute a kubectl Command. Add more functions to customize the builder as needed.
func NewKubectlCommand ¶
func NewKubectlCommand(args ...string) *KubectlBuilder
NewKubectlCommand return a KubectlBuilder
func (KubectlBuilder) ExecOrDie ¶
func (b KubectlBuilder) ExecOrDie() string
ExecOrDie indicates execute or die
func (*KubectlBuilder) WithEnv ¶
func (b *KubectlBuilder) WithEnv(env []string) *KubectlBuilder
WithEnv sets env
func (KubectlBuilder) WithStdinData ¶
func (b KubectlBuilder) WithStdinData(data string) *KubectlBuilder
WithStdinData sets stdin data
func (KubectlBuilder) WithStdinReader ¶
func (b KubectlBuilder) WithStdinReader(reader io.Reader) *KubectlBuilder
WithStdinReader sets stdin reader
func (*KubectlBuilder) WithTimeout ¶
func (b *KubectlBuilder) WithTimeout(t <-chan time.Time) *KubectlBuilder
WithTimeout sets timeout
type NodeTestContextType ¶
type NodeTestContextType struct {
// NodeE2E indicates whether it is running node e2e.
NodeE2E bool
// Name of the node to run tests on.
NodeName string
// NodeConformance indicates whether the test is running in node conformance mode.
NodeConformance bool
// PrepullImages indicates whether node e2e framework should prepull images.
PrepullImages bool
// ImageDescription is the description of the image on which the test is running.
ImageDescription string
// SystemSpecName is the name of the system spec (e.g., gke) that's used in
// the node e2e test. If empty, the default one (system.DefaultSpec) is
// used. The system specs are in test/e2e_node/system/specs/.
SystemSpecName string
// ExtraEnvs is a map of environment names to values.
ExtraEnvs map[string]string
}
NodeTestContextType is part of TestContextType, it is shared by all node e2e test.
type NullProvider ¶
type NullProvider struct{}
NullProvider is the default implementation of the ProviderInterface which doesn't do anything.
func (NullProvider) CleanupServiceResources ¶
func (n NullProvider) CleanupServiceResources(c clientset.Interface, loadBalancerName, region, zone string)
CleanupServiceResources no usages
func (NullProvider) CreatePD ¶
func (n NullProvider) CreatePD(zone string) (string, error)
CreatePD no usages
func (NullProvider) CreatePVSource ¶
func (n NullProvider) CreatePVSource(zone, diskName string) (*corev1.PersistentVolumeSource, error)
CreatePVSource no usages
func (NullProvider) DeletePD ¶
func (n NullProvider) DeletePD(pdName string) error
DeletePD no usages
func (NullProvider) DeletePVSource ¶
func (n NullProvider) DeletePVSource(pvSource *corev1.PersistentVolumeSource) error
DeletePVSource no usages
func (NullProvider) EnableAndDisableInternalLB ¶
func (n NullProvider) EnableAndDisableInternalLB() (enable, disable func(svc *corev1.Service))
EnableAndDisableInternalLB no usages
func (NullProvider) EnsureLoadBalancerResourcesDeleted ¶
func (n NullProvider) EnsureLoadBalancerResourcesDeleted(ip, portRange string) error
EnsureLoadBalancerResourcesDeleted no usages
func (NullProvider) FrameworkAfterEach ¶
func (n NullProvider) FrameworkAfterEach(f *Framework)
FrameworkAfterEach is framework after each
func (NullProvider) FrameworkBeforeEach ¶
func (n NullProvider) FrameworkBeforeEach(f *Framework)
FrameworkBeforeEach is a framework before each
func (NullProvider) GetGroupNodes ¶
func (n NullProvider) GetGroupNodes(group string) ([]string, error)
GetGroupNodes no usages
func (NullProvider) GroupSize ¶
func (n NullProvider) GroupSize(group string) (int, error)
GroupSize no usages
func (NullProvider) LoadBalancerSrcRanges ¶
func (n NullProvider) LoadBalancerSrcRanges() []string
LoadBalancerSrcRanges no usages
func (NullProvider) ResizeGroup ¶
func (n NullProvider) ResizeGroup(string, int32) error
ResizeGroup no usages
type OperationJobTester ¶
type OperationJobTester struct {
// contains filtered or unexported fields
}
func NewOperationJobTester ¶
func (*OperationJobTester) CreateOperationJob ¶
func (t *OperationJobTester) CreateOperationJob(oj *appsv1alpha1.OperationJob) error
func (*OperationJobTester) DeleteOperationJob ¶
func (t *OperationJobTester) DeleteOperationJob(oj *appsv1alpha1.OperationJob) error
func (*OperationJobTester) ExpectOperationJobProgress ¶
func (t *OperationJobTester) ExpectOperationJobProgress(oj *appsv1alpha1.OperationJob, progress appsv1alpha1.OperationProgress) error
func (*OperationJobTester) GetOperationJob ¶
func (t *OperationJobTester) GetOperationJob(oj *appsv1alpha1.OperationJob) error
func (*OperationJobTester) ListPodsForOperationJobTester ¶
func (t *OperationJobTester) ListPodsForOperationJobTester(oj *appsv1alpha1.OperationJob) (pods []*v1.Pod, err error)
func (*OperationJobTester) NewOperationJob ¶
func (t *OperationJobTester) NewOperationJob(name, action string, targets []appsv1alpha1.PodOpsTarget) *appsv1alpha1.OperationJob
func (*OperationJobTester) UpdateOperationJob ¶
func (t *OperationJobTester) UpdateOperationJob(oj *appsv1alpha1.OperationJob, fn func(oj *appsv1alpha1.OperationJob)) error
type Options ¶
type Options struct {
ClientQPS float32
ClientBurst int
GroupVersion *schema.GroupVersion
}
Options is a struct for managing test framework options.
type ProviderInterface ¶
type ProviderInterface interface {
FrameworkBeforeEach(f *Framework)
FrameworkAfterEach(f *Framework)
ResizeGroup(group string, size int32) error
GetGroupNodes(group string) ([]string, error)
GroupSize(group string) (int, error)
CreatePD(zone string) (string, error)
DeletePD(pdName string) error
CreatePVSource(zone, diskName string) (*corev1.PersistentVolumeSource, error)
DeletePVSource(pvSource *corev1.PersistentVolumeSource) error
CleanupServiceResources(c clientset.Interface, loadBalancerName, region, zone string)
EnsureLoadBalancerResourcesDeleted(ip, portRange string) error
LoadBalancerSrcRanges() []string
EnableAndDisableInternalLB() (enable, disable func(svc *corev1.Service))
}
ProviderInterface contains the implementation for certain provider-specific functionality.
func SetupProviderConfig ¶
func SetupProviderConfig(providerName string) (ProviderInterface, error)
SetupProviderConfig validates the chosen provider and creates an interface instance for it.
type TestContextType ¶
type TestContextType struct {
KubeConfig string
KubeContext string
KubeAPIContentType string
KubeVolumeDir string
CertDir string
Host string
// TODO: Deprecating this over time... instead just use gobindata_util.go , see #23987.
RepoRoot string
DockershimCheckpointDir string
// Provider identifies the infrastructure provider (gce, gke, aws)
Provider string
// Tooling is the tooling in use (e.g. kops, gke). Provider is the cloud provider and might not uniquely identify the tooling.
Tooling string
CloudConfig CloudConfig
KubectlPath string
OutputDir string
ReportDir string
ReportPrefix string
Prefix string
MinStartupPods int
// Timeout for waiting for system pods to be running
SystemPodsStartupTimeout time.Duration
EtcdUpgradeStorage string
EtcdUpgradeVersion string
IngressUpgradeImage string
GCEUpgradeScript string
ContainerRuntime string
ContainerRuntimeEndpoint string
ContainerRuntimeProcessName string
ContainerRuntimePidFile string
// SystemdServices are comma separated list of systemd services the test framework
// will dump logs for.
SystemdServices string
ImageServiceEndpoint string
MasterOSDistro string
NodeOSDistro string
VerifyServiceAccount bool
DeleteNamespace bool
DeleteNamespaceOnFailure bool
AllowedNotReadyNodes int
CleanStart bool
// If set to 'true' or 'all' framework will start a goroutine monitoring resource usage of system add-ons.
// It will read the data every 30 seconds from all Nodes and print summary during afterEach. If set to 'master'
// only master Node will be monitored.
GatherKubeSystemResourceUsageData string
GatherLogsSizes bool
GatherMetricsAfterTest string
GatherSuiteMetricsAfterTest bool
AllowGatheringProfiles bool
// If set to 'true' framework will gather ClusterAutoscaler metrics when gathering them for other components.
IncludeClusterAutoscalerMetrics bool
// Currently supported values are 'hr' for human-readable and 'json'. It's a comma separated list.
OutputPrintType string
// NodeSchedulableTimeout is the timeout for waiting for all nodes to be schedulable.
NodeSchedulableTimeout time.Duration
// SystemDaemonsetStartupTimeout is the timeout for waiting for all system daemonsets to be ready.
SystemDaemonsetStartupTimeout time.Duration
// CreateTestingNS is responsible for creating namespace used for executing e2e tests.
// It accepts namespace base name, which will be prepended with e2e prefix, kube client
// and labels to be applied to a namespace.
CreateTestingNS CreateTestingNSFn
// If set to true test will dump data about the namespace in which test was running.
DumpLogsOnFailure bool
// Disables dumping cluster log from master and nodes after all tests.
DisableLogDump bool
// Path to the GCS artifacts directory to dump logs from nodes. Logexporter gets enabled if this is non-empty.
LogexporterGCSPath string
// featureGates is a map of feature names to bools that enable or disable alpha/experimental features.
FeatureGates map[string]bool
// Node e2e specific test context
NodeTestContextType
// Monitoring solution that is used in current cluster.
ClusterMonitoringMode string
// Separate Prometheus monitoring deployed in cluster
EnablePrometheusMonitoring bool
// Indicates what path the kubernetes-anywhere is installed on
KubernetesAnywherePath string
// The DNS Domain of the cluster.
ClusterDNSDomain string
}
TestContextType contains test settings and global state. Due to historic reasons, it is a mixture of items managed by the test framework itself, cloud providers and individual tests. The goal is to move anything not required by the framework into the code which uses the settings.
The recommendation for those settings is:
- They are stored in their own context structure or local variables.
- The standard `flag` package is used to register them. The flag name should follow the pattern <part1>.<part2>....<partn> where the prefix is unlikely to conflict with other tests or standard packages and each part is in lower camel case. For example, test/e2e/storage/csi/context.go could define storage.csi.numIterations.
- framework/config can be used to simplify the registration of multiple options with a single function call: var storageCSI { NumIterations `default:"1" usage:"number of iterations"` } _ config.AddOptions(&storageCSI, "storage.csi")
- The direct use Viper in tests is possible, but discouraged because it only works in test suites which use Viper (which is not required) and the supported options cannot be discovered by a test suite user.
Test suite authors can use framework/viper to make all command line parameters also configurable via a configuration file.
var TestContext TestContextType
TestContext defines a context include test settings and global state