framework

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: Apache-2.0 Imports: 81 Imported by: 2

Documentation

Overview

+kubebuilder:skip

Index

Constants

View Source
const (
	// DaemonSetRetryPeriod indicates poll interval for DaemonSet tests
	DaemonSetRetryPeriod = 1 * time.Second
	// DaemonSetRetryTimeout indicates timeout interval for DaemonSet operations
	DaemonSetRetryTimeout = 5 * time.Minute

	DaemonSetLabelPrefix = "daemonset-"
	DaemonSetNameLabel   = DaemonSetLabelPrefix + "name"
	DaemonSetColorLabel  = DaemonSetLabelPrefix + "color"
)
View Source
const (
	// StatefulSetPoll indicates poll interval for StatefulSet tests
	StatefulSetPoll = 3 * time.Second
	// StatefulSetTimeout indicates timeout interval for StatefulSet operations
	StatefulSetTimeout = 10 * time.Minute
	// StatefulPodTimeout indicates timeout for stateful pods to change state
	StatefulPodTimeout = 5 * time.Minute
)
View Source
const (
	// PodListTimeout indicates how long to wait for the pod to be listable
	PodListTimeout = time.Minute
	// 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

	// PodStartShortTimeout is same as `PodStartTimeout` to wait for the pod to be started, but shorter.
	// Use it case by case when we are sure pod start will not be delayed
	// minutes by slow docker pulls or something else.
	PodStartShortTimeout = 2 * time.Minute

	// PodDeleteTimeout indicates how long to wait for a pod to be deleted
	PodDeleteTimeout = 5 * time.Minute

	// PodEventTimeout is how much we wait for a pod event to occur.
	PodEventTimeout = 2 * time.Minute

	// NamespaceCleanupTimeout indicates:
	// If there are any orphaned namespaces to clean up, this test is running
	// on a long lived cluster. A long wait here is preferably to spurious test
	// failures caused by leaked resources from a previous test run.
	NamespaceCleanupTimeout = 15 * time.Minute

	// ServiceStartTimeout indicates how long to wait for a service endpoint to be resolvable.
	ServiceStartTimeout = 3 * 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

	// NodeReadyInitialTimeout indicates how long nodes have to be "ready" when a test begins. They should already
	// be "ready" before the test starts, so this is small.
	NodeReadyInitialTimeout = 20 * time.Second

	// PodReadyBeforeTimeout indicates how long pods have to be "ready" when a test begins.
	PodReadyBeforeTimeout = 5 * time.Minute

	// ClaimProvisionTimeout indicates how long claims have to become dynamically provisioned
	ClaimProvisionTimeout = 5 * time.Minute

	// ClaimProvisionShortTimeout is same as `ClaimProvisionTimeout` to wait for claim to be dynamically provisioned, but shorter.
	// Use it case by case when we are sure this timeout is enough.
	ClaimProvisionShortTimeout = 1 * time.Minute

	// ClaimBindingTimeout indicates how long claims have to become bound
	ClaimBindingTimeout = 3 * time.Minute

	// ClaimDeletingTimeout indicates how long claims have to become deleted
	ClaimDeletingTimeout = 3 * time.Minute

	// PVReclaimingTimeout indicates how long PVs have to beome reclaimed
	PVReclaimingTimeout = 3 * time.Minute

	// PVBindingTimeout indicates how long PVs have to become bound
	PVBindingTimeout = 3 * time.Minute

	// PVDeletingTimeout indicates how long PVs have to become deleted
	PVDeletingTimeout = 3 * time.Minute

	// RestartNodeReadyAgainTimeout indicates how long a node is allowed to become "Ready" after it is restarted before
	// the test is considered failed.
	RestartNodeReadyAgainTimeout = 5 * time.Minute

	// RestartPodReadyAgainTimeout indicates how long a pod is allowed to become "running" and "ready" after a node
	// restart before test is considered failed.
	RestartPodReadyAgainTimeout = 5 * time.Minute
)
View Source
const (
	DefaultNamespaceDeletionTimeout = 5 * time.Minute
)
View Source
const (
	E2eFakeKey = "kruise-e2e-fake"
)
View Source
const (
	// Allow fake NodeImage with no Node related, just for tests
	FakeNodeImageLabelKey = "apps.kruise.io/fake-nodeimage"
)

Variables

View Source
var (
	// UnreachableTaintTemplate is the taint for when a node becomes unreachable.
	UnreachableTaintTemplate = &v1.Taint{
		Key:    v1.TaintNodeUnreachable,
		Effect: v1.TaintEffectNoExecute,
	}
	// NotReadyTaintTemplate is the taint for when a node doesn't ready.
	NotReadyTaintTemplate = &v1.Taint{
		Key:    v1.TaintNodeNotReady,
		Effect: v1.TaintEffectNoExecute,
	}
)
View Source
var RunID = uuid.NewUUID()

RunID is a unique identifier of the e2e run

View Source
var StatefulSetLikeTestKind = kruiseappsv1beta1.GroupVersion.WithKind("StatefulSetLikeTest")

Functions

func AfterReadingAllFlags

func AfterReadingAllFlags(t *TestContextType)

AfterReadingAllFlags makes changes to the context after all flags have been read.

func AllNodesReady

func AllNodesReady(c clientset.Interface, timeout time.Duration) error

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

func ConformanceIt(text string, body interface{}, timeout ...float64) bool

ConformanceIt is a wrapper function for ginkgo It. Adds "[Conformance]" tag and makes static analysis easier.

func CreatePV

CreatePV creates the PV resource. Fails test on error.

func CreateServiceSpec

func CreateServiceSpec(serviceName, externalName string, isHeadless bool, selector map[string]string) *v1.Service

CreateServiceSpec creates service spec

func CreateStatefulSetService

func CreateStatefulSetService(name string, labels map[string]string) *v1.Service

CreateStatefulSetService creates a Headless Service with Name name and Selector set to match labels.

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 DeleteAllStatefulSets

func DeleteAllStatefulSets(c clientset.Interface, kc kruiseclientset.Interface, ns string)

DeleteAllStatefulSets deletes all StatefulSet API Objects in Namespace ns.

func DumpAllNamespaceInfo

func DumpAllNamespaceInfo(c clientset.Interface, namespace string)

DumpAllNamespaceInfo is used to dump all namespace info

func DumpDebugInfo

func DumpDebugInfo(c clientset.Interface, ns string)

DumpDebugInfo dumps debug info

func DumpEventsInNamespace

func DumpEventsInNamespace(eventsLister EventsLister, namespace string)

DumpEventsInNamespace dump events in namespace

func ExpectEqual added in v0.8.0

func ExpectEqual(actual interface{}, 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

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 ExpectNoErrorWithRetries

func ExpectNoErrorWithRetries(fn func() error, maxRetries int, explain ...interface{})

ExpectNoErrorWithRetries checks if "err" is set with retries

func Failf

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

Failf print fail log

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 Filter added in v1.7.0

func Filter(nodeList *v1.NodeList, fn func(node v1.Node) bool)

Filter filters nodes in NodeList in place, removing nodes that do not satisfy the given condition

func FilterNodes

func FilterNodes(nodeList *v1.NodeList, fn func(node v1.Node) bool)

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 GetDefaultStorageClassName added in v1.1.0

func GetDefaultStorageClassName(c clientset.Interface) (string, error)

GetDefaultStorageClassName returns default storageClass or return error

func GetRandomReadySchedulableNode added in v1.7.0

func GetRandomReadySchedulableNode(ctx context.Context, c clientset.Interface) (*v1.Node, error)

GetRandomReadySchedulableNode gets a single randomly-selected node which is available for running pods on. If there are no available nodes it will return an error.

func GetReadySchedulableNodes added in v1.7.0

func GetReadySchedulableNodes(ctx context.Context, c clientset.Interface) (nodes *v1.NodeList, err error)

GetReadySchedulableNodes 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. If there are no nodes that are both ready and schedulable, this will return an error.

func GetReadySchedulableNodesOrDie

func GetReadySchedulableNodesOrDie(c clientset.Interface) (nodes *v1.NodeList)

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 IsConditionSetAsExpected added in v1.7.0

func IsConditionSetAsExpected(node *v1.Node, conditionType v1.NodeConditionType, wantTrue bool) bool

IsConditionSetAsExpected returns a wantTrue value if the node has a match to the conditionType, otherwise returns an opposite value of the wantTrue with detailed logging.

func IsConditionSetAsExpectedSilent added in v1.7.0

func IsConditionSetAsExpectedSilent(node *v1.Node, conditionType v1.NodeConditionType, wantTrue bool) bool

IsConditionSetAsExpectedSilent returns a wantTrue value if the node has a match to the conditionType, otherwise returns an opposite value of the wantTrue.

func IsNodeConditionSetAsExpected

func IsNodeConditionSetAsExpected(node *v1.Node, conditionType v1.NodeConditionType, wantTrue bool) bool

IsNodeConditionSetAsExpected indicate if node is ready

func IsNodeConditionSetAsExpectedSilent

func IsNodeConditionSetAsExpectedSilent(node *v1.Node, conditionType v1.NodeConditionType, wantTrue bool) bool

IsNodeConditionSetAsExpectedSilent indicate if node is ready with silent

func IsNodeConditionUnset

func IsNodeConditionUnset(node *v1.Node, conditionType v1.NodeConditionType) bool

IsNodeConditionUnset indicate if set condition

func IsNodeReady added in v1.7.0

func IsNodeReady(node *v1.Node) bool

IsNodeReady returns true if: 1) it's Ready condition is set to true 2) doesn't have NetworkUnavailable condition set to true

func IsNodeSchedulable added in v1.7.0

func IsNodeSchedulable(node *v1.Node) bool

IsNodeSchedulable returns true if: 1) doesn't have "unschedulable" field set 2) it also returns true from IsNodeReady

func KruiseDescribe

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

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

func KubectlCmd

func KubectlCmd(args ...string) *exec.Cmd

KubectlCmd runs the kubectl executable through the wrapper script.

func LoadClientset

func LoadClientset() (*clientset.Clientset, error)

LoadClientset loads config of client set

func LoadConfig

func LoadConfig() (*restclient.Config, error)

LoadConfig loads config

func Logf

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

Logf print info log

func NewStatefulSet

func NewStatefulSet(name, ns, governingSvcName string, replicas int32, statefulPodMounts []v1.VolumeMount, podMounts []v1.VolumeMount, labels map[string]string) *appsv1beta1.StatefulSet

NewStatefulSet creates a new NGINX StatefulSet for testing. The StatefulSet is named name, is in namespace ns, statefulPodsMounts are the mounts that will be backed by PVs. podsMounts are the mounts that are mounted directly to the Pod. labels are the labels that will be usd for the StatefulSet selector.

func NewStatefulSetPVC

func NewStatefulSetPVC(name string) v1.PersistentVolumeClaim

NewStatefulSetPVC returns a PersistentVolumeClaim named name, for testing StatefulSets.

func NewStatefulSetScale

func NewStatefulSetScale(ss *appsv1beta1.StatefulSet) *appsV1beta2.Scale

NewStatefulSetScale creates a new StatefulSet scale subresource and returns it

func RegisterClusterFlags

func RegisterClusterFlags(flags *flag.FlagSet)

RegisterClusterFlags registers flags specific to the cluster e2e test suite.

func RegisterCommonFlags

func RegisterCommonFlags(flags *flag.FlagSet)

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

func RegisterProvider(name string, factory Factory)

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

func RunHostCmd(ns, name, cmd string) (string, error)

RunHostCmd runs the given cmd in the context of the given pod using `kubectl exec` inside of a shell.

func RunHostCmdWithRetries

func RunHostCmdWithRetries(ns, name, cmd string, interval, timeout time.Duration) (string, error)

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

func RunKubectl(args ...string) (string, error)

RunKubectl is a convenience wrapper over KubectlBuilder

func RunKubectlOrDie

func RunKubectlOrDie(args ...string) string

RunKubectlOrDie is a convenience wrapper over KubectlBuilder

func SkipIfNoDefaultStorageClass added in v1.1.0

func SkipIfNoDefaultStorageClass(c clientset.Interface) bool

SkipIfNoDefaultStorageClass skips tests if no default SC can be found.

func SortStatefulPods added in v1.7.0

func SortStatefulPods(pods *v1.PodList)

func UpdateStatefulSetWithRetries

func UpdateStatefulSetWithRetries(kc kruiseclientset.Interface, namespace, name string, applyUpdate updateStatefulSetFunc) (statefulSet *appsv1beta1.StatefulSet, err error)

UpdateStatefulSetWithRetries update StatefulSet with retries

func WaitForDefaultServiceAccountInNamespace

func WaitForDefaultServiceAccountInNamespace(c clientset.Interface, namespace string) error

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 WaitForNodeSchedulable added in v1.7.0

func WaitForNodeSchedulable(ctx context.Context, c clientset.Interface, name string, timeout time.Duration, wantSchedulable bool) bool

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

func WaitForPodNameRunningInNamespace(c clientset.Interface, podName, namespace string) error

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

func WaitForPodRunningInNamespace(c clientset.Interface, pod *v1.Pod) error

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.

func WaitTimeoutForPodRunningInNamespace

func WaitTimeoutForPodRunningInNamespace(c clientset.Interface, podName, namespace string, timeout time.Duration) error

WaitTimeoutForPodRunningInNamespace waits default amount of time

Types

type BroadcastJobTester added in v0.8.1

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

func NewBroadcastJobTester added in v0.8.1

func NewBroadcastJobTester(c clientset.Interface, kc kruiseclientset.Interface, ns string) *BroadcastJobTester

func (*BroadcastJobTester) CreateBroadcastJob added in v0.8.1

func (*BroadcastJobTester) GetBroadcastJob added in v0.8.1

func (t *BroadcastJobTester) GetBroadcastJob(name string) (*appsv1alpha1.BroadcastJob, error)

func (*BroadcastJobTester) GetPodsOfJob added in v0.8.1

func (t *BroadcastJobTester) GetPodsOfJob(job *appsv1alpha1.BroadcastJob) (pods []*v1.Pod, err error)

func (*BroadcastJobTester) WaitForBroadcastJobCreated added in v0.10.0

func (t *BroadcastJobTester) WaitForBroadcastJobCreated(job *appsv1alpha1.BroadcastJob)

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 CloneSetTester added in v0.8.0

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

func NewCloneSetTester added in v0.8.0

func NewCloneSetTester(c clientset.Interface, kc kruiseclientset.Interface, ns string) *CloneSetTester

func (*CloneSetTester) CreateCloneSet added in v0.8.0

func (t *CloneSetTester) CreateCloneSet(cs *appsv1alpha1.CloneSet) (*appsv1alpha1.CloneSet, error)

func (*CloneSetTester) DeleteCloneSet added in v0.9.0

func (t *CloneSetTester) DeleteCloneSet(name string) error

func (*CloneSetTester) DeletePod added in v1.5.0

func (t *CloneSetTester) DeletePod(name string) error

func (*CloneSetTester) GetCloneSet added in v0.8.0

func (t *CloneSetTester) GetCloneSet(name string) (*appsv1alpha1.CloneSet, error)

func (*CloneSetTester) GetSelectorPods added in v1.0.0

func (t *CloneSetTester) GetSelectorPods(namespace string, selector *metav1.LabelSelector) ([]v1.Pod, error)

func (*CloneSetTester) ListImagePullJobsForCloneSet added in v0.9.0

func (t *CloneSetTester) ListImagePullJobsForCloneSet(name string) (jobs []*appsv1alpha1.ImagePullJob, err error)

func (*CloneSetTester) ListPVCForCloneSet added in v1.4.0

func (t *CloneSetTester) ListPVCForCloneSet() (pvcs []*v1.PersistentVolumeClaim, err error)

func (*CloneSetTester) ListPodsForCloneSet added in v1.0.0

func (t *CloneSetTester) ListPodsForCloneSet(name string) (pods []*v1.Pod, err error)

func (*CloneSetTester) NewCloneSet added in v0.8.0

func (t *CloneSetTester) NewCloneSet(name string, replicas int32, updateStrategy appsv1alpha1.CloneSetUpdateStrategy) *appsv1alpha1.CloneSet

func (*CloneSetTester) UpdateCloneSet added in v0.9.0

func (t *CloneSetTester) UpdateCloneSet(name string, fn func(cs *appsv1alpha1.CloneSet)) error

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 ContainerRecreateTester added in v0.9.0

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

func NewContainerRecreateTester added in v0.9.0

func NewContainerRecreateTester(c clientset.Interface, kc kruiseclientset.Interface, ns string) *ContainerRecreateTester

func (*ContainerRecreateTester) CleanAllTestResources added in v0.9.0

func (t *ContainerRecreateTester) CleanAllTestResources() error

func (*ContainerRecreateTester) CreateCRR added in v0.9.0

func (*ContainerRecreateTester) CreateTestCloneSetAndGetPods added in v0.9.0

func (t *ContainerRecreateTester) CreateTestCloneSetAndGetPods(randStr string, replicas int32, containers []v1.Container) (pods []*v1.Pod)

func (*ContainerRecreateTester) GetCRR added in v0.9.0

func (*ContainerRecreateTester) GetPod added in v0.9.0

func (t *ContainerRecreateTester) GetPod(name string) (*v1.Pod, error)

type CreateTestingNSFn

type CreateTestingNSFn func(baseName string, c clientset.Interface, labels map[string]string) (*v1.Namespace, error)

CreateTestingNSFn defines a function to create test

type DaemonSetTester added in v0.9.0

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

func NewDaemonSetTester added in v0.9.0

func NewDaemonSetTester(c clientset.Interface, kc kruiseclientset.Interface, ns string) *DaemonSetTester

func (*DaemonSetTester) CanScheduleOnNode added in v0.9.0

func (t *DaemonSetTester) CanScheduleOnNode(node v1.Node, ds *appsv1alpha1.DaemonSet) bool

func (*DaemonSetTester) CheckDaemonPodOnNodes added in v0.9.0

func (t *DaemonSetTester) CheckDaemonPodOnNodes(ds *appsv1alpha1.DaemonSet, nodeNames []string) func() (bool, error)

func (*DaemonSetTester) CheckDaemonReady added in v1.0.0

func (t *DaemonSetTester) CheckDaemonReady(dsName string) func() (bool, error)

func (*DaemonSetTester) CheckDaemonStatus added in v0.9.0

func (t *DaemonSetTester) CheckDaemonStatus(dsName string) error

func (*DaemonSetTester) CheckPodHasNotRecreate added in v1.0.0

func (t *DaemonSetTester) CheckPodHasNotRecreate(oldPods, newPods []v1.Pod) bool

func (*DaemonSetTester) CheckPodStayInNode added in v1.0.0

func (t *DaemonSetTester) CheckPodStayInNode(oldNodeList *v1.NodeList, newNodeList *v1.NodeList) func() (bool, error)

func (*DaemonSetTester) CheckRunningOnAllNodes added in v0.9.0

func (t *DaemonSetTester) CheckRunningOnAllNodes(ds *appsv1alpha1.DaemonSet) func() (bool, error)

func (*DaemonSetTester) CheckRunningOnNoNodes added in v0.9.0

func (t *DaemonSetTester) CheckRunningOnNoNodes(ds *appsv1alpha1.DaemonSet) func() (bool, error)

func (*DaemonSetTester) ClearDaemonSetNodeLabels added in v0.9.0

func (t *DaemonSetTester) ClearDaemonSetNodeLabels(c clientset.Interface) error

func (*DaemonSetTester) CreateDaemonSet added in v0.9.0

func (t *DaemonSetTester) CreateDaemonSet(ds *appsv1alpha1.DaemonSet) (*appsv1alpha1.DaemonSet, error)

func (*DaemonSetTester) DaemonPodHasReadinessGate added in v1.0.0

func (t *DaemonSetTester) DaemonPodHasReadinessGate(pods []v1.Pod) bool

func (*DaemonSetTester) DeleteDaemonSet added in v0.9.0

func (t *DaemonSetTester) DeleteDaemonSet(namespace, name string)

func (*DaemonSetTester) GetDaemonSet added in v0.9.0

func (t *DaemonSetTester) GetDaemonSet(name string) (*appsv1alpha1.DaemonSet, error)

func (*DaemonSetTester) GetNewPodsToCheckImage added in v1.0.0

func (t *DaemonSetTester) GetNewPodsToCheckImage(label map[string]string, newImage string) func() (bool, error)

func (*DaemonSetTester) GetNodesToDaemonPods added in v1.3.0

func (t *DaemonSetTester) GetNodesToDaemonPods(label map[string]string) (map[string][]*v1.Pod, error)

func (*DaemonSetTester) GetPod added in v1.1.0

func (t *DaemonSetTester) GetPod(name string) (*v1.Pod, error)

func (*DaemonSetTester) ListDaemonPods added in v0.9.0

func (t *DaemonSetTester) ListDaemonPods(label map[string]string) (*v1.PodList, error)

func (*DaemonSetTester) NewDaemonSet added in v0.9.0

func (t *DaemonSetTester) NewDaemonSet(name string, label map[string]string, image string, updateStrategy appsv1alpha1.DaemonSetUpdateStrategy) *appsv1alpha1.DaemonSet

func (*DaemonSetTester) PatchDaemonSet added in v0.9.0

func (t *DaemonSetTester) PatchDaemonSet(name string, patchType types.PatchType, patch []byte) (*appsv1alpha1.DaemonSet, error)

func (*DaemonSetTester) PatchPod added in v1.1.0

func (t *DaemonSetTester) PatchPod(name string, patchType types.PatchType, patch []byte) (*v1.Pod, error)

func (*DaemonSetTester) SchedulableNodes added in v0.9.0

func (t *DaemonSetTester) SchedulableNodes(ds *appsv1alpha1.DaemonSet) []string

func (*DaemonSetTester) SeparateDaemonSetNodeLabels added in v0.9.0

func (t *DaemonSetTester) SeparateDaemonSetNodeLabels(labels map[string]string) (map[string]string, map[string]string)

func (*DaemonSetTester) SetDaemonSetNodeLabels added in v0.9.0

func (t *DaemonSetTester) SetDaemonSetNodeLabels(nodeName string, labels map[string]string) (*v1.Node, error)

func (*DaemonSetTester) SortPodNames added in v1.1.0

func (t *DaemonSetTester) SortPodNames(podList *v1.PodList) []string

func (*DaemonSetTester) UpdateDaemonSet added in v0.9.0

func (t *DaemonSetTester) UpdateDaemonSet(name string, fn func(ds *appsv1alpha1.DaemonSet)) error

func (*DaemonSetTester) WaitFailedDaemonPodDeleted added in v0.9.0

func (t *DaemonSetTester) WaitFailedDaemonPodDeleted(pod *v1.Pod) func() (bool, error)

func (*DaemonSetTester) WaitForDaemonSetDeleted added in v0.9.0

func (t *DaemonSetTester) WaitForDaemonSetDeleted(namespace, name string)

type DeploymentTester added in v1.0.0

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

func NewDeploymentTester added in v1.0.0

func NewDeploymentTester(c clientset.Interface, ns string) *DeploymentTester

func (*DeploymentTester) CreateDeployment added in v1.0.0

func (t *DeploymentTester) CreateDeployment(dp *appsv1.Deployment) (*appsv1.Deployment, error)

func (*DeploymentTester) GetDeployment added in v1.0.0

func (t *DeploymentTester) GetDeployment(name string) (*appsv1.Deployment, error)

func (*DeploymentTester) GetSelectorPods added in v1.0.0

func (t *DeploymentTester) GetSelectorPods(namespace string, selector *metav1.LabelSelector) ([]v1.Pod, error)

func (*DeploymentTester) NewDeployment added in v1.0.0

func (t *DeploymentTester) NewDeployment(name string, replicas int32) *appsv1.Deployment

type EphemeralJobTester added in v1.0.0

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

func NewEphemeralJobTester added in v1.0.0

func NewEphemeralJobTester(c clientset.Interface, kc kruiseclientset.Interface, ns string) *EphemeralJobTester

func (*EphemeralJobTester) CheckEphemeralJobExist added in v1.0.0

func (t *EphemeralJobTester) CheckEphemeralJobExist(job *appsv1alpha1.EphemeralJob) bool

func (*EphemeralJobTester) CreateEphemeralJob added in v1.0.0

func (*EphemeralJobTester) CreateTestDeployment added in v1.0.0

func (t *EphemeralJobTester) CreateTestDeployment(randStr string, replicas int32, containers []v1.Container) (pods []*v1.Pod)

func (*EphemeralJobTester) CreateTestEphemeralJob added in v1.0.0

func (t *EphemeralJobTester) CreateTestEphemeralJob(randStr string, replicas, Parallelism int32, selector metav1.LabelSelector, containers []v1.EphemeralContainer) *appsv1alpha1.EphemeralJob

func (*EphemeralJobTester) DeleteDeployment added in v1.0.0

func (s *EphemeralJobTester) DeleteDeployment(deployment *apps.Deployment)

func (*EphemeralJobTester) DeleteDeployments added in v1.0.0

func (s *EphemeralJobTester) DeleteDeployments(namespace string)

func (*EphemeralJobTester) DeleteEphemeralJob added in v1.0.0

func (t *EphemeralJobTester) DeleteEphemeralJob(job *appsv1alpha1.EphemeralJob)

func (*EphemeralJobTester) DeleteEphemeralJobs added in v1.0.0

func (s *EphemeralJobTester) DeleteEphemeralJobs(ns string)

func (*EphemeralJobTester) GetEphemeralJob added in v1.0.0

func (t *EphemeralJobTester) GetEphemeralJob(name string) (*appsv1alpha1.EphemeralJob, error)

func (*EphemeralJobTester) GetPodsByEjob added in v1.0.0

func (t *EphemeralJobTester) GetPodsByEjob(name string) ([]*v1.Pod, error)

func (*EphemeralJobTester) WaitForDeploymentDeleted added in v1.0.0

func (s *EphemeralJobTester) WaitForDeploymentDeleted(deployment *apps.Deployment)

func (*EphemeralJobTester) WaitForDeploymentRunning added in v1.0.0

func (s *EphemeralJobTester) WaitForDeploymentRunning(deployment *apps.Deployment)

func (*EphemeralJobTester) WaitForEphemeralJobCreated added in v1.0.0

func (t *EphemeralJobTester) WaitForEphemeralJobCreated(job *appsv1alpha1.EphemeralJob)

func (*EphemeralJobTester) WaitForEphemeralJobDeleted added in v1.0.0

func (t *EphemeralJobTester) WaitForEphemeralJobDeleted(job *appsv1alpha1.EphemeralJob)

type EventsLister

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

EventsLister defines a event listener

type Factory

type Factory func() (ProviderInterface, error)

Factory represents the factory pattern

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

	KruiseClientSet kruiseclientset.Interface
	ClientSet       clientset.Interface

	ApiExtensionsClientSet apiextensionsclientset.Interface

	DynamicClient dynamic.Interface

	ScalesGetter scaleclient.ScalesGetter

	SkipNamespaceCreation bool          // Whether to skip creating a namespace
	Namespace             *v1.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

func NewDefaultFramework(baseName string) *Framework

NewDefaultFramework makes a new framework and sets up a BeforeEach/AfterEach for you (you can write additional before/after each functions).

func NewFramework

func NewFramework(baseName string, options Options, client clientset.Interface) *Framework

NewFramework makes a new framework and sets up a BeforeEach/AfterEach

func (*Framework) AddNamespacesToDelete

func (f *Framework) AddNamespacesToDelete(namespaces ...*v1.Namespace)

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 is used to create namespace

func (*Framework) PodClient

func (f *Framework) PodClient() *PodClient

PodClient is convenience method for getting a pod client interface in the framework's namespace, possibly applying test-suite specific transformations to the pod spec, e.g. for node e2e pod scheduling.

func (*Framework) WaitForPodRunning

func (f *Framework) WaitForPodRunning(podName string) error

WaitForPodRunning waits for the pod to run in the namespace.

func (*Framework) WithDisruptive added in v1.7.0

func (f *Framework) WithDisruptive() interface{}

WithDisruptive is a shorthand for the corresponding package function.

func (*Framework) WithSerial added in v1.7.0

func (f *Framework) WithSerial() interface{}

WithSerial is a shorthand for the corresponding package function.

type ImageListPullJobTester added in v1.5.0

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

func NewImageListPullJobTester added in v1.5.0

func NewImageListPullJobTester(c clientset.Interface, kc kruiseclientset.Interface) *ImageListPullJobTester

func (*ImageListPullJobTester) CreateJob added in v1.5.0

func (*ImageListPullJobTester) DeleteAllJobs added in v1.5.0

func (tester *ImageListPullJobTester) DeleteAllJobs(ns string) error

func (*ImageListPullJobTester) DeleteJob added in v1.5.0

func (*ImageListPullJobTester) FailNodeImageFast added in v1.5.0

func (tester *ImageListPullJobTester) FailNodeImageFast(name string) error

func (*ImageListPullJobTester) GetJob added in v1.5.0

func (*ImageListPullJobTester) ListJobs added in v1.5.0

type ImagePullJobTester added in v0.8.0

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

func NewImagePullJobTester added in v0.8.0

func NewImagePullJobTester(c clientset.Interface, kc kruiseclientset.Interface) *ImagePullJobTester

func (*ImagePullJobTester) CreateJob added in v0.8.0

func (tester *ImagePullJobTester) CreateJob(job *appsv1alpha1.ImagePullJob) error

func (*ImagePullJobTester) CreateSecret added in v1.4.2

func (tester *ImagePullJobTester) CreateSecret(secret *v1.Secret) (*v1.Secret, error)

func (*ImagePullJobTester) DeleteAllJobs added in v0.8.0

func (tester *ImagePullJobTester) DeleteAllJobs(ns string) error

func (*ImagePullJobTester) DeleteJob added in v0.8.0

func (tester *ImagePullJobTester) DeleteJob(job *appsv1alpha1.ImagePullJob) error

func (*ImagePullJobTester) GetJob added in v0.8.0

func (*ImagePullJobTester) ListJobs added in v0.8.0

func (tester *ImagePullJobTester) ListJobs(ns string) (*appsv1alpha1.ImagePullJobList, error)

func (*ImagePullJobTester) ListSyncedSecrets added in v1.4.2

func (tester *ImagePullJobTester) ListSyncedSecrets(source *v1.Secret) ([]v1.Secret, error)

func (*ImagePullJobTester) UpdateSecret added in v1.4.2

func (tester *ImagePullJobTester) UpdateSecret(secret *v1.Secret) (*v1.Secret, error)

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) Exec

func (b KubectlBuilder) Exec() (string, error)

Exec executes

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 NodeImageTester added in v0.8.0

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

func NewNodeImageTester added in v0.8.0

func NewNodeImageTester(c clientset.Interface, kc kruiseclientset.Interface) *NodeImageTester

func (*NodeImageTester) CreateFakeNodeImageIfNotPresent added in v0.8.0

func (tester *NodeImageTester) CreateFakeNodeImageIfNotPresent() error

func (*NodeImageTester) DeleteFakeNodeImage added in v0.8.0

func (tester *NodeImageTester) DeleteFakeNodeImage() error

func (*NodeImageTester) ExpectNodes added in v0.8.0

func (tester *NodeImageTester) ExpectNodes() ([]*v1.Node, error)

func (*NodeImageTester) GetNodeImage added in v0.8.0

func (tester *NodeImageTester) GetNodeImage(name string) (*appsv1alpha1.NodeImage, error)

func (*NodeImageTester) IsImageInSpec added in v0.8.0

func (tester *NodeImageTester) IsImageInSpec(image, nodeName string) (bool, error)

func (*NodeImageTester) ListNodeImages added in v0.8.0

func (tester *NodeImageTester) ListNodeImages() (*appsv1alpha1.NodeImageList, error)

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 NodeTester added in v0.8.1

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

func NewNodeTester added in v0.8.1

func NewNodeTester(c clientset.Interface) *NodeTester

func (*NodeTester) CreateFakeNode added in v0.8.1

func (t *NodeTester) CreateFakeNode(randStr string) (node *v1.Node, err error)

func (*NodeTester) DeleteFakeNode added in v0.8.1

func (t *NodeTester) DeleteFakeNode(randStr string) error

func (*NodeTester) ListNodesWithFake added in v0.10.0

func (t *NodeTester) ListNodesWithFake() ([]*v1.Node, error)

func (*NodeTester) ListRealNodesWithFake added in v0.8.1

func (t *NodeTester) ListRealNodesWithFake(tolerations []v1.Toleration) ([]*v1.Node, error)

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) (*v1.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 *v1.PersistentVolumeSource) error

DeletePVSource no usages

func (NullProvider) EnableAndDisableInternalLB

func (n NullProvider) EnableAndDisableInternalLB() (enable, disable func(svc *v1.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 Options

type Options struct {
	ClientQPS    float32
	ClientBurst  int
	GroupVersion *schema.GroupVersion
}

Options contains some options

type PersistentPodStateTester added in v1.2.0

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

func (*PersistentPodStateTester) AddStatefulsetLikeClusterRoleConf added in v1.4.0

func (s *PersistentPodStateTester) AddStatefulsetLikeClusterRoleConf()

func (*PersistentPodStateTester) CheckStatefulsetLikeCRDExist added in v1.4.0

func (s *PersistentPodStateTester) CheckStatefulsetLikeCRDExist() (bool, error)

func (*PersistentPodStateTester) CreateDynamicWatchWhiteList added in v1.4.0

func (s *PersistentPodStateTester) CreateDynamicWatchWhiteList(gvks []schema.GroupVersionKind)

func (*PersistentPodStateTester) CreateStatefulset added in v1.2.0

func (s *PersistentPodStateTester) CreateStatefulset(sts *appsv1.StatefulSet)

func (*PersistentPodStateTester) CreateStatefulsetLike added in v1.4.0

func (s *PersistentPodStateTester) CreateStatefulsetLike(sts *StatefulSetLikeTest) *StatefulSetLikeTest

func (*PersistentPodStateTester) CreateStatefulsetLikeCRD added in v1.4.0

func (s *PersistentPodStateTester) CreateStatefulsetLikeCRD(namespace string)

func (*PersistentPodStateTester) CreateStatefulsetLikePods added in v1.4.0

func (s *PersistentPodStateTester) CreateStatefulsetLikePods(sts *StatefulSetLikeTest)

func (*PersistentPodStateTester) ListPodsInKruiseSts added in v1.2.0

func (s *PersistentPodStateTester) ListPodsInKruiseSts(sts *appsv1.StatefulSet) ([]*corev1.Pod, error)

func (*PersistentPodStateTester) ListPodsInNamespace added in v1.4.0

func (s *PersistentPodStateTester) ListPodsInNamespace(ns string) ([]*corev1.Pod, error)

func (*PersistentPodStateTester) NewBaseStatefulset added in v1.2.0

func (s *PersistentPodStateTester) NewBaseStatefulset(namespace string) *appsv1.StatefulSet

func (*PersistentPodStateTester) NewBaseStatefulsetLikeTest added in v1.4.0

func (s *PersistentPodStateTester) NewBaseStatefulsetLikeTest(namespace string) *StatefulSetLikeTest

func (*PersistentPodStateTester) UpdateStatefulset added in v1.2.0

func (s *PersistentPodStateTester) UpdateStatefulset(sts *appsv1.StatefulSet)

func (*PersistentPodStateTester) UpdateStatefulsetLikeStatus added in v1.4.0

func (s *PersistentPodStateTester) UpdateStatefulsetLikeStatus(sts *StatefulSetLikeTest)

func (*PersistentPodStateTester) WaitForStatefulsetRunning added in v1.2.0

func (s *PersistentPodStateTester) WaitForStatefulsetRunning(sts *appsv1.StatefulSet)

type PodClient

type PodClient struct {
	v1core.PodInterface
	// contains filtered or unexported fields
}

PodClient defines a convenience method for getting a pod client interface in the framework's namespace

func (*PodClient) Update

func (c *PodClient) Update(name string, updateFn func(pod *v1.Pod))

Update updates the pod object. It retries if there is a conflict, throw out error if there is any other errors. name is the pod name, updateFn is the function updating the pod object.

type PodProbeMarkerTester added in v1.3.0

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

func NewPodProbeMarkerTester added in v1.3.0

func NewPodProbeMarkerTester(c clientset.Interface, kc kruiseclientset.Interface) *PodProbeMarkerTester

func (*PodProbeMarkerTester) CreateStatefulSet added in v1.3.0

func (s *PodProbeMarkerTester) CreateStatefulSet(sts *appsv1beta1.StatefulSet)

func (*PodProbeMarkerTester) ListActivePods added in v1.3.0

func (s *PodProbeMarkerTester) ListActivePods(ns string) ([]*corev1.Pod, error)

func (*PodProbeMarkerTester) NewBaseStatefulSet added in v1.3.0

func (s *PodProbeMarkerTester) NewBaseStatefulSet(namespace, randStr string) *appsv1beta1.StatefulSet

func (*PodProbeMarkerTester) NewPodProbeMarker added in v1.3.0

func (s *PodProbeMarkerTester) NewPodProbeMarker(ns, randStr string) []appsv1alpha1.PodProbeMarker

func (*PodProbeMarkerTester) NewPodProbeMarkerForTcpCheck added in v1.6.0

func (s *PodProbeMarkerTester) NewPodProbeMarkerForTcpCheck(ns, randStr string) []appsv1alpha1.PodProbeMarker

func (*PodProbeMarkerTester) NewPodProbeMarkerWithProbeImg added in v1.5.2

func (s *PodProbeMarkerTester) NewPodProbeMarkerWithProbeImg(ns, randStr string) appsv1alpha1.PodProbeMarker

func (*PodProbeMarkerTester) NewStatefulSetWithProbeImg added in v1.5.2

func (s *PodProbeMarkerTester) NewStatefulSetWithProbeImg(namespace, randStr string) *appsv1beta1.StatefulSet

func (*PodProbeMarkerTester) WaitForStatefulSetRunning added in v1.3.0

func (s *PodProbeMarkerTester) WaitForStatefulSetRunning(sts *appsv1beta1.StatefulSet)

type PodUnavailableBudgetTester added in v1.0.0

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

func NewPodUnavailableBudgetTester added in v1.0.0

func NewPodUnavailableBudgetTester(c clientset.Interface, kc kruiseclientset.Interface) *PodUnavailableBudgetTester

func (*PodUnavailableBudgetTester) CreateCloneSet added in v1.0.0

func (*PodUnavailableBudgetTester) CreateDeployment added in v1.0.0

func (t *PodUnavailableBudgetTester) CreateDeployment(deployment *apps.Deployment)

func (*PodUnavailableBudgetTester) CreatePub added in v1.0.0

func (*PodUnavailableBudgetTester) DeleteCloneSets added in v1.0.0

func (t *PodUnavailableBudgetTester) DeleteCloneSets(namespace string)

func (*PodUnavailableBudgetTester) DeleteDeployments added in v1.0.0

func (t *PodUnavailableBudgetTester) DeleteDeployments(namespace string)

func (*PodUnavailableBudgetTester) DeletePubs added in v1.0.0

func (t *PodUnavailableBudgetTester) DeletePubs(namespace string)

func (*PodUnavailableBudgetTester) NewBaseCloneSet added in v1.0.0

func (s *PodUnavailableBudgetTester) NewBaseCloneSet(namespace string) *appsv1alpha1.CloneSet

func (*PodUnavailableBudgetTester) NewBaseDeployment added in v1.0.0

func (s *PodUnavailableBudgetTester) NewBaseDeployment(namespace string) *apps.Deployment

func (*PodUnavailableBudgetTester) NewBasePub added in v1.0.0

func (*PodUnavailableBudgetTester) WaitForCloneSetDeleted added in v1.0.0

func (t *PodUnavailableBudgetTester) WaitForCloneSetDeleted(cloneset *appsv1alpha1.CloneSet)

func (*PodUnavailableBudgetTester) WaitForCloneSetMinReadyAndRunning added in v1.0.0

func (t *PodUnavailableBudgetTester) WaitForCloneSetMinReadyAndRunning(cloneSets []*appsv1alpha1.CloneSet, minReady int32)

func (*PodUnavailableBudgetTester) WaitForCloneSetRunning added in v1.0.0

func (t *PodUnavailableBudgetTester) WaitForCloneSetRunning(cloneset *appsv1alpha1.CloneSet)

func (*PodUnavailableBudgetTester) WaitForDeploymentDeleted added in v1.0.0

func (t *PodUnavailableBudgetTester) WaitForDeploymentDeleted(deployment *apps.Deployment)

func (*PodUnavailableBudgetTester) WaitForDeploymentReadyAndRunning added in v1.3.0

func (t *PodUnavailableBudgetTester) WaitForDeploymentReadyAndRunning(deployment *apps.Deployment)

func (*PodUnavailableBudgetTester) WaitForPubCreated added in v1.0.0

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) (*v1.PersistentVolumeSource, error)
	DeletePVSource(pvSource *v1.PersistentVolumeSource) error

	CleanupServiceResources(c clientset.Interface, loadBalancerName, region, zone string)

	EnsureLoadBalancerResourcesDeleted(ip, portRange string) error
	LoadBalancerSrcRanges() []string
	EnableAndDisableInternalLB() (enable, disable func(svc *v1.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 ResourceDistributionTester added in v1.0.0

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

func NewResourceDistributionTester added in v1.0.0

func NewResourceDistributionTester(c clientset.Interface, kc kruiseclientset.Interface) *ResourceDistributionTester

func (*ResourceDistributionTester) CreateNamespaces added in v1.0.0

func (s *ResourceDistributionTester) CreateNamespaces(namespaces ...*corev1.Namespace)

func (*ResourceDistributionTester) CreateResourceDistribution added in v1.0.0

func (s *ResourceDistributionTester) CreateResourceDistribution(resourceDistribution *appsv1alpha1.ResourceDistribution) *appsv1alpha1.ResourceDistribution

func (*ResourceDistributionTester) CreateSecretResources added in v1.0.0

func (s *ResourceDistributionTester) CreateSecretResources(secrets ...*corev1.Secret)

func (*ResourceDistributionTester) DeleteNamespace added in v1.0.0

func (s *ResourceDistributionTester) DeleteNamespace(namespace *corev1.Namespace)

func (*ResourceDistributionTester) DeleteNamespaces added in v1.0.0

func (s *ResourceDistributionTester) DeleteNamespaces(nsPrefix string)

func (*ResourceDistributionTester) DeleteResourceDistribution added in v1.0.0

func (s *ResourceDistributionTester) DeleteResourceDistribution(resourceDistribution *appsv1alpha1.ResourceDistribution)

func (*ResourceDistributionTester) DeleteResourceDistributions added in v1.0.0

func (s *ResourceDistributionTester) DeleteResourceDistributions(nsPrefix string)

func (*ResourceDistributionTester) DeleteSecret added in v1.0.1

func (s *ResourceDistributionTester) DeleteSecret(namespace, name string) error

func (*ResourceDistributionTester) GetNamespaceForDistributor added in v1.0.0

func (s *ResourceDistributionTester) GetNamespaceForDistributor(targets *appsv1alpha1.ResourceDistributionTargets) (matchedNamespaces, unmatchedNamespaces sets.String, err error)

func (*ResourceDistributionTester) GetResourceDistribution added in v1.0.0

func (s *ResourceDistributionTester) GetResourceDistribution(name string, mustExistAssertion bool) (*appsv1alpha1.ResourceDistribution, error)

func (*ResourceDistributionTester) GetSecret added in v1.0.0

func (s *ResourceDistributionTester) GetSecret(namespace, name string, mustExistAssertion bool) (*corev1.Secret, error)

func (*ResourceDistributionTester) NewBaseNamespace added in v1.0.0

func (s *ResourceDistributionTester) NewBaseNamespace(namespace string) *corev1.Namespace

func (*ResourceDistributionTester) NewBaseResourceDistribution added in v1.0.0

func (s *ResourceDistributionTester) NewBaseResourceDistribution(nsPrefix string) *appsv1alpha1.ResourceDistribution

func (*ResourceDistributionTester) UpdateNamespace added in v1.0.0

func (s *ResourceDistributionTester) UpdateNamespace(namespace *corev1.Namespace)

func (*ResourceDistributionTester) UpdateResourceDistribution added in v1.0.0

func (s *ResourceDistributionTester) UpdateResourceDistribution(resourceDistribution *appsv1alpha1.ResourceDistribution)

func (*ResourceDistributionTester) UpdateSecret added in v1.0.1

func (s *ResourceDistributionTester) UpdateSecret(secret *corev1.Secret) error

func (*ResourceDistributionTester) WaitForNamespaceCreated added in v1.0.0

func (s *ResourceDistributionTester) WaitForNamespaceCreated(namespace *corev1.Namespace)

func (*ResourceDistributionTester) WaitForNamespaceDeleted added in v1.0.0

func (s *ResourceDistributionTester) WaitForNamespaceDeleted(namespace *corev1.Namespace)

func (*ResourceDistributionTester) WaitForResourceDistributionCreated added in v1.0.0

func (s *ResourceDistributionTester) WaitForResourceDistributionCreated(name string, timeout time.Duration)

func (*ResourceDistributionTester) WaitForResourceDistributionDeleted added in v1.0.0

func (s *ResourceDistributionTester) WaitForResourceDistributionDeleted(resourceDistribution *appsv1alpha1.ResourceDistribution)

func (*ResourceDistributionTester) WaitForSecretCreated added in v1.0.0

func (s *ResourceDistributionTester) WaitForSecretCreated(namespace, name string, timeout time.Duration)

type SidecarSetTester added in v0.8.0

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

func NewSidecarSetTester added in v0.8.0

func NewSidecarSetTester(c clientset.Interface, kc kruiseclientset.Interface) *SidecarSetTester

func (*SidecarSetTester) CreateCloneSet added in v0.9.0

func (t *SidecarSetTester) CreateCloneSet(cloneset *appsv1alpha1.CloneSet) *appsv1alpha1.CloneSet

func (*SidecarSetTester) CreateDeployment added in v0.8.0

func (s *SidecarSetTester) CreateDeployment(deployment *apps.Deployment)

func (*SidecarSetTester) CreateSidecarSet added in v0.8.0

func (s *SidecarSetTester) CreateSidecarSet(sidecarSet *appsv1alpha1.SidecarSet) (*appsv1alpha1.SidecarSet, error)

func (*SidecarSetTester) DeleteDeployment added in v0.8.0

func (s *SidecarSetTester) DeleteDeployment(deployment *apps.Deployment)

func (*SidecarSetTester) DeleteDeployments added in v0.8.0

func (s *SidecarSetTester) DeleteDeployments(namespace string)

func (*SidecarSetTester) DeleteSidecarSet added in v0.8.0

func (s *SidecarSetTester) DeleteSidecarSet(sidecarSet *appsv1alpha1.SidecarSet)

func (*SidecarSetTester) DeleteSidecarSets added in v0.8.0

func (s *SidecarSetTester) DeleteSidecarSets()

func (*SidecarSetTester) GetSelectorPods added in v0.8.0

func (s *SidecarSetTester) GetSelectorPods(namespace string, selector *metav1.LabelSelector) ([]*corev1.Pod, error)

func (*SidecarSetTester) ListControllerRevisions added in v1.0.1

func (t *SidecarSetTester) ListControllerRevisions(sidecarSet *appsv1alpha1.SidecarSet) []*apps.ControllerRevision

func (*SidecarSetTester) NewBaseCloneSet added in v0.9.0

func (s *SidecarSetTester) NewBaseCloneSet(namespace string) *appsv1alpha1.CloneSet

func (*SidecarSetTester) NewBaseDeployment added in v0.8.0

func (s *SidecarSetTester) NewBaseDeployment(namespace string) *apps.Deployment

func (*SidecarSetTester) NewBaseSidecarSet added in v0.8.0

func (s *SidecarSetTester) NewBaseSidecarSet(ns string) *appsv1alpha1.SidecarSet

func (*SidecarSetTester) UpdateDeployment added in v1.5.1

func (s *SidecarSetTester) UpdateDeployment(obj *apps.Deployment)

func (*SidecarSetTester) UpdatePod added in v0.8.0

func (s *SidecarSetTester) UpdatePod(pod *corev1.Pod)

func (*SidecarSetTester) UpdateSidecarSet added in v0.8.0

func (s *SidecarSetTester) UpdateSidecarSet(sidecarSet *appsv1alpha1.SidecarSet)

func (*SidecarSetTester) WaitForCloneSetRunning added in v0.9.0

func (t *SidecarSetTester) WaitForCloneSetRunning(cloneset *appsv1alpha1.CloneSet)

func (*SidecarSetTester) WaitForDeploymentDeleted added in v0.8.0

func (s *SidecarSetTester) WaitForDeploymentDeleted(deployment *apps.Deployment)

func (*SidecarSetTester) WaitForDeploymentRunning added in v0.8.0

func (s *SidecarSetTester) WaitForDeploymentRunning(deployment *apps.Deployment)

func (*SidecarSetTester) WaitForSidecarSetCreated added in v0.8.0

func (s *SidecarSetTester) WaitForSidecarSetCreated(sidecarSet *appsv1alpha1.SidecarSet)

func (*SidecarSetTester) WaitForSidecarSetDeleted added in v0.8.0

func (s *SidecarSetTester) WaitForSidecarSetDeleted(sidecarSet *appsv1alpha1.SidecarSet)

func (*SidecarSetTester) WaitForSidecarSetMinReadyAndUpgrade added in v1.0.0

func (s *SidecarSetTester) WaitForSidecarSetMinReadyAndUpgrade(sidecarSet *appsv1alpha1.SidecarSet, exceptStatus *appsv1alpha1.SidecarSetStatus, minReady int32)

func (*SidecarSetTester) WaitForSidecarSetUpgradeComplete added in v0.8.0

func (s *SidecarSetTester) WaitForSidecarSetUpgradeComplete(sidecarSet *appsv1alpha1.SidecarSet, exceptStatus *appsv1alpha1.SidecarSetStatus)

type StatefulSetLikeStatusSpec added in v1.4.0

type StatefulSetLikeStatusSpec struct {
	Replicas      int32 `json:"replicas" protobuf:"varint,2,opt,name=replicas"`
	ReadyReplicas int32 `json:"readyReplicas,omitempty" protobuf:"varint,3,opt,name=readyReplicas"`
}

type StatefulSetLikeTest added in v1.4.0

type StatefulSetLikeTest struct {
	metav1.TypeMeta
	metav1.ObjectMeta
	Spec   StatefulSetLikeTestSpec   `json:"spec"`
	Status StatefulSetLikeStatusSpec `json:"status"`
}

func (*StatefulSetLikeTest) DeepCopy added in v1.4.0

func (in *StatefulSetLikeTest) DeepCopy() *StatefulSetLikeTest

func (*StatefulSetLikeTest) DeepCopyInto added in v1.4.0

func (in *StatefulSetLikeTest) DeepCopyInto(out *StatefulSetLikeTest)

func (*StatefulSetLikeTest) DeepCopyObject added in v1.4.0

func (in *StatefulSetLikeTest) DeepCopyObject() runtime.Object

type StatefulSetLikeTestList added in v1.4.0

type StatefulSetLikeTestList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`

	Items []StatefulSetLikeTest `json:"items"`
}

type StatefulSetLikeTestSpec added in v1.4.0

type StatefulSetLikeTestSpec struct {
	Replicas *int32                 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
	Selector *metav1.LabelSelector  `json:"selector" protobuf:"bytes,2,opt,name=selector"`
	Template corev1.PodTemplateSpec `json:"template" protobuf:"bytes,3,opt,name=template"`
}

type StatefulSetTester

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

StatefulSetTester is a struct that contains utility methods for testing StatefulSet related functionality. It uses a clientset.Interface to communicate with the API server.

func NewStatefulSetTester

func NewStatefulSetTester(c clientset.Interface, kc kruiseclientset.Interface) *StatefulSetTester

NewStatefulSetTester creates a StatefulSetTester that uses c to interact with the API server.

func (*StatefulSetTester) BreakHTTPProbe

func (s *StatefulSetTester) BreakHTTPProbe(ss *appsv1beta1.StatefulSet) error

BreakHTTPProbe breaks the readiness probe for Nginx StatefulSet containers in ss.

func (*StatefulSetTester) BreakPodHTTPProbe

func (s *StatefulSetTester) BreakPodHTTPProbe(ss *appsv1beta1.StatefulSet, pod *v1.Pod) error

BreakPodHTTPProbe breaks the readiness probe for Nginx StatefulSet containers in one pod.

func (*StatefulSetTester) CheckHostname

func (s *StatefulSetTester) CheckHostname(ss *appsv1beta1.StatefulSet) error

CheckHostname verifies that all Pods in ss have the correct Hostname. If the returned error is not nil than verification failed.

func (*StatefulSetTester) CheckMount

func (s *StatefulSetTester) CheckMount(ss *appsv1beta1.StatefulSet, mountPath string) error

CheckMount checks that the mount at mountPath is valid for all Pods in ss.

func (*StatefulSetTester) CheckServiceName

func (s *StatefulSetTester) CheckServiceName(ss *appsv1beta1.StatefulSet, expectedServiceName string) error

CheckServiceName asserts that the ServiceName for ss is equivalent to expectedServiceName.

func (*StatefulSetTester) ConfirmStatefulPodCount

func (s *StatefulSetTester) ConfirmStatefulPodCount(count int, ss *appsv1beta1.StatefulSet, timeout time.Duration, hard bool)

ConfirmStatefulPodCount asserts that the current number of Pods in ss is count waiting up to timeout for ss to to scale to count.

func (*StatefulSetTester) CreateStatefulSet

func (s *StatefulSetTester) CreateStatefulSet(manifestPath, ns string) *appsv1beta1.StatefulSet

CreateStatefulSet creates a StatefulSet from the manifest at manifestPath in the Namespace ns using kubectl create.

func (*StatefulSetTester) DeleteStatefulPodAtIndex

func (s *StatefulSetTester) DeleteStatefulPodAtIndex(index int, ss *appsv1beta1.StatefulSet)

DeleteStatefulPodAtIndex deletes the Pod with ordinal index in ss.

func (*StatefulSetTester) ExecInStatefulPods

func (s *StatefulSetTester) ExecInStatefulPods(ss *appsv1beta1.StatefulSet, cmd string) error

ExecInStatefulPods executes cmd in all Pods in ss. If a error occurs it is returned and cmd is not execute in any subsequent Pods.

func (*StatefulSetTester) GetPodList

func (s *StatefulSetTester) GetPodList(ss *appsv1beta1.StatefulSet) *v1.PodList

GetPodList gets the current Pods in ss.

func (*StatefulSetTester) GetStatefulSet

func (s *StatefulSetTester) GetStatefulSet(namespace, name string) *appsv1beta1.StatefulSet

GetStatefulSet gets the StatefulSet named name in namespace.

func (*StatefulSetTester) PauseNewPods

func (s *StatefulSetTester) PauseNewPods(ss *appsv1beta1.StatefulSet)

PauseNewPods adds an always-failing ReadinessProbe to the StatefulSet PodTemplate. This causes all newly-created Pods to stay Unready until they are manually resumed with ResumeNextPod(). Note that this cannot be used together with SetHTTPProbe().

func (*StatefulSetTester) Restart

func (s *StatefulSetTester) Restart(ss *appsv1beta1.StatefulSet)

Restart scales ss to 0 and then back to its previous number of replicas.

func (*StatefulSetTester) RestoreHTTPProbe

func (s *StatefulSetTester) RestoreHTTPProbe(ss *appsv1beta1.StatefulSet) error

RestoreHTTPProbe restores the readiness probe for Nginx StatefulSet containers in ss.

func (*StatefulSetTester) RestorePodHTTPProbe

func (s *StatefulSetTester) RestorePodHTTPProbe(ss *appsv1beta1.StatefulSet, pod *v1.Pod) error

RestorePodHTTPProbe restores the readiness probe for Nginx StatefulSet containers in pod.

func (*StatefulSetTester) ResumeNextPod

func (s *StatefulSetTester) ResumeNextPod(ss *appsv1beta1.StatefulSet)

ResumeNextPod allows the next Pod in the StatefulSet to continue by removing the ReadinessProbe added by PauseNewPods(), if it's still there. It fails the test if it finds any pods that are not in phase Running, or if it finds more than one paused Pod existing at the same time. This is a no-op if there are no paused pods.

func (*StatefulSetTester) Saturate

func (s *StatefulSetTester) Saturate(ss *appsv1beta1.StatefulSet)

Saturate waits for all Pods in ss to become Running and Ready.

func (*StatefulSetTester) Scale

Scale scales ss to count replicas.

func (*StatefulSetTester) SetHTTPProbe

func (s *StatefulSetTester) SetHTTPProbe(ss *appsv1beta1.StatefulSet)

SetHTTPProbe sets the pod template's ReadinessProbe for Nginx StatefulSet containers. This probe can then be controlled with BreakHTTPProbe() and RestoreHTTPProbe(). Note that this cannot be used together with PauseNewPods().

func (*StatefulSetTester) SortStatefulPods

func (s *StatefulSetTester) SortStatefulPods(pods *v1.PodList)

SortStatefulPods sorts pods by their ordinals

func (*StatefulSetTester) UpdateReplicas

func (s *StatefulSetTester) UpdateReplicas(ss *appsv1beta1.StatefulSet, count int32)

UpdateReplicas updates the replicas of ss to count.

func (*StatefulSetTester) VerifyPodAtIndex

func (s *StatefulSetTester) VerifyPodAtIndex(index int, ss *appsv1beta1.StatefulSet, verify VerifyStatefulPodFunc)

VerifyPodAtIndex applies a visitor patter to the Pod at index in ss. verify is applied to the Pod to "visit" it.

func (*StatefulSetTester) WaitForPartitionedRollingUpdate

func (s *StatefulSetTester) WaitForPartitionedRollingUpdate(set *appsv1beta1.StatefulSet) (*appsv1beta1.StatefulSet, *v1.PodList)

WaitForPartitionedRollingUpdate waits for all Pods in set to exist and have the correct revision. set must have a RollingUpdateStatefulSetStrategyType with a non-nil RollingUpdate and Partition. All Pods with ordinals less than or equal to the Partition are expected to be at set's current revision. All other Pods are expected to be at its update revision.

func (*StatefulSetTester) WaitForPodNotReady

func (s *StatefulSetTester) WaitForPodNotReady(set *appsv1beta1.StatefulSet, podName string) (*appsv1beta1.StatefulSet, *v1.PodList)

WaitForPodNotReady waist for the Pod named podName in set to exist and to not have a Ready condition.

func (*StatefulSetTester) WaitForPodReady

func (s *StatefulSetTester) WaitForPodReady(set *appsv1beta1.StatefulSet, podName string) (*appsv1beta1.StatefulSet, *v1.PodList)

WaitForPodReady waits for the Pod named podName in set to exist and have a Ready condition.

func (*StatefulSetTester) WaitForPodUpdatedAndRunning added in v1.7.0

func (s *StatefulSetTester) WaitForPodUpdatedAndRunning(set *appsv1beta1.StatefulSet, podName string, currentRevision string) (*appsv1beta1.StatefulSet, *v1.PodList)

WaitForPodUpdatedAndRunning wait for the Pod named podName to be updated and running, the pod should have revision other than the one in currentRevision

func (*StatefulSetTester) WaitForRollingUpdate

func (s *StatefulSetTester) WaitForRollingUpdate(set *appsv1beta1.StatefulSet) (*appsv1beta1.StatefulSet, *v1.PodList)

WaitForRollingUpdate waits for all Pods in set to exist and have the correct revision and for the RollingUpdate to complete. set must have a RollingUpdateStatefulSetStrategyType.

func (*StatefulSetTester) WaitForRunning

func (s *StatefulSetTester) WaitForRunning(numPodsRunning, numPodsReady int32, ss *appsv1beta1.StatefulSet)

WaitForRunning waits for numPodsRunning in ss to be Running and for the first numPodsReady ordinals to be Ready.

func (*StatefulSetTester) WaitForRunningAndNotReady

func (s *StatefulSetTester) WaitForRunningAndNotReady(numStatefulPods int32, ss *appsv1beta1.StatefulSet)

WaitForRunningAndNotReady waits for numStatefulPods in ss to be Running and not Ready.

func (*StatefulSetTester) WaitForRunningAndReady

func (s *StatefulSetTester) WaitForRunningAndReady(numStatefulPods int32, ss *appsv1beta1.StatefulSet)

WaitForRunningAndReady waits for numStatefulPods in ss to be Running and Ready.

func (*StatefulSetTester) WaitForState

func (s *StatefulSetTester) WaitForState(ss *appsv1beta1.StatefulSet, until func(*appsv1beta1.StatefulSet, *v1.PodList) (bool, error))

WaitForState periodically polls for the ss and its pods until the until function returns either true or an error

func (*StatefulSetTester) WaitForStatus

WaitForStatus waits for the StatefulSetStatus's ObservedGeneration to be greater than or equal to set's Generation. The returned StatefulSet contains such a StatefulSetStatus

func (*StatefulSetTester) WaitForStatusReadyReplicas

func (s *StatefulSetTester) WaitForStatusReadyReplicas(ss *appsv1beta1.StatefulSet, expectedReplicas int32)

WaitForStatusReadyReplicas waits for the ss.Status.ReadyReplicas to be equal to expectedReplicas

func (*StatefulSetTester) WaitForStatusReplicas

func (s *StatefulSetTester) WaitForStatusReplicas(ss *appsv1beta1.StatefulSet, expectedReplicas int32)

WaitForStatusReplicas waits for the ss.Status.Replicas to be equal to expectedReplicas

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

type TestDataSummary

type TestDataSummary interface {
	SummaryKind() string
	PrintHumanReadable() string
	PrintJSON() string
}

TestDataSummary defines a interface to test data summary

type UnitedDeploymentManager added in v1.5.1

type UnitedDeploymentManager struct {
	*appsv1alpha1.UnitedDeployment
	// contains filtered or unexported fields
}

func (*UnitedDeploymentManager) AddSubset added in v1.5.1

func (m *UnitedDeploymentManager) AddSubset(name string, replicas, minReplicas, maxReplicas *intstr.IntOrString)

func (*UnitedDeploymentManager) CheckSubsets added in v1.5.1

func (m *UnitedDeploymentManager) CheckSubsets(replicas map[string]int32)

func (*UnitedDeploymentManager) Create added in v1.5.1

func (m *UnitedDeploymentManager) Create(replicas int32)

func (*UnitedDeploymentManager) Scale added in v1.5.1

func (m *UnitedDeploymentManager) Scale(replicas int32)

type UnitedDeploymentTester added in v1.5.1

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

func NewUnitedDeploymentTester added in v1.5.1

func NewUnitedDeploymentTester(c clientset.Interface, kc kruiseclientset.Interface, ns string) *UnitedDeploymentTester

func (*UnitedDeploymentTester) NewUnitedDeploymentManager added in v1.5.1

func (t *UnitedDeploymentTester) NewUnitedDeploymentManager(name string) *UnitedDeploymentManager

type VerifyStatefulPodFunc

type VerifyStatefulPodFunc func(*v1.Pod)

VerifyStatefulPodFunc is a func that examines a StatefulSetPod.

type WorkloadSpreadTester added in v0.10.1

type WorkloadSpreadTester struct {
	C clientset.Interface
	// contains filtered or unexported fields
}

func NewWorkloadSpreadTester added in v0.10.1

func NewWorkloadSpreadTester(c clientset.Interface, kc kruiseclientset.Interface) *WorkloadSpreadTester

func (*WorkloadSpreadTester) CreateCloneSet added in v0.10.1

func (t *WorkloadSpreadTester) CreateCloneSet(cloneSet *appsv1alpha1.CloneSet) *appsv1alpha1.CloneSet

func (*WorkloadSpreadTester) CreateDeployment added in v0.10.1

func (t *WorkloadSpreadTester) CreateDeployment(deployment *appsv1.Deployment) *appsv1.Deployment

func (*WorkloadSpreadTester) CreateJob added in v0.10.1

func (t *WorkloadSpreadTester) CreateJob(job *batchv1.Job) *batchv1.Job

func (*WorkloadSpreadTester) CreateService added in v1.3.0

func (t *WorkloadSpreadTester) CreateService(svc *corev1.Service)

func (*WorkloadSpreadTester) CreateStatefulSet added in v1.3.0

func (t *WorkloadSpreadTester) CreateStatefulSet(statefulSet *appsv1alpha1.StatefulSet) *appsv1beta1.StatefulSet

func (*WorkloadSpreadTester) CreateWorkloadSpread added in v0.10.1

func (t *WorkloadSpreadTester) CreateWorkloadSpread(workloadSpread *appsv1alpha1.WorkloadSpread) *appsv1alpha1.WorkloadSpread

func (*WorkloadSpreadTester) GetCloneSet added in v1.0.0

func (t *WorkloadSpreadTester) GetCloneSet(namespace, name string) (*appsv1alpha1.CloneSet, error)

func (*WorkloadSpreadTester) GetSelectorPods added in v0.10.1

func (t *WorkloadSpreadTester) GetSelectorPods(namespace string, selector *metav1.LabelSelector) ([]corev1.Pod, error)

func (*WorkloadSpreadTester) GetWorkloadSpread added in v1.0.0

func (t *WorkloadSpreadTester) GetWorkloadSpread(namespace, name string) (*appsv1alpha1.WorkloadSpread, error)

func (*WorkloadSpreadTester) NewBaseCloneSet added in v0.10.1

func (t *WorkloadSpreadTester) NewBaseCloneSet(namespace string) *appsv1alpha1.CloneSet

func (*WorkloadSpreadTester) NewBaseDeployment added in v0.10.1

func (t *WorkloadSpreadTester) NewBaseDeployment(namespace string) *appsv1.Deployment

func (*WorkloadSpreadTester) NewBaseHeadlessStatefulSet added in v1.3.0

func (t *WorkloadSpreadTester) NewBaseHeadlessStatefulSet(namespace string) (*appsv1alpha1.StatefulSet, *corev1.Service)

func (*WorkloadSpreadTester) NewBaseJob added in v0.10.1

func (t *WorkloadSpreadTester) NewBaseJob(namespace string) *batchv1.Job

func (*WorkloadSpreadTester) NewWorkloadSpread added in v0.10.1

func (t *WorkloadSpreadTester) NewWorkloadSpread(namespace, name string, targetRef *appsv1alpha1.TargetReference, subsets []appsv1alpha1.WorkloadSpreadSubset) *appsv1alpha1.WorkloadSpread

func (*WorkloadSpreadTester) SetNodeLabel added in v0.10.1

func (t *WorkloadSpreadTester) SetNodeLabel(c clientset.Interface, node *corev1.Node, key, value string)

func (*WorkloadSpreadTester) UpdateCloneSet added in v0.10.1

func (t *WorkloadSpreadTester) UpdateCloneSet(cloneSet *appsv1alpha1.CloneSet)

func (*WorkloadSpreadTester) UpdateDeployment added in v0.10.1

func (t *WorkloadSpreadTester) UpdateDeployment(deployment *appsv1.Deployment)

func (*WorkloadSpreadTester) UpdateWorkloadSpread added in v0.10.1

func (t *WorkloadSpreadTester) UpdateWorkloadSpread(workloadSpread *appsv1alpha1.WorkloadSpread)

func (*WorkloadSpreadTester) WaitForCloneSetRunReplicas added in v0.10.1

func (t *WorkloadSpreadTester) WaitForCloneSetRunReplicas(cloneSet *appsv1alpha1.CloneSet, replicas int32)

func (*WorkloadSpreadTester) WaitForCloneSetRunning added in v0.10.1

func (t *WorkloadSpreadTester) WaitForCloneSetRunning(cloneSet *appsv1alpha1.CloneSet)

func (*WorkloadSpreadTester) WaitForDeploymentRunning added in v0.10.1

func (t *WorkloadSpreadTester) WaitForDeploymentRunning(deployment *appsv1.Deployment)

func (*WorkloadSpreadTester) WaitForStatefulSetRunning added in v1.3.0

func (t *WorkloadSpreadTester) WaitForStatefulSetRunning(statefulSet *appsv1beta1.StatefulSet)

func (*WorkloadSpreadTester) WaitForWorkloadSpreadRunning added in v0.10.1

func (t *WorkloadSpreadTester) WaitForWorkloadSpreadRunning(ws *appsv1alpha1.WorkloadSpread)

func (*WorkloadSpreadTester) WaitJobCompleted added in v0.10.1

func (t *WorkloadSpreadTester) WaitJobCompleted(job *batchv1.Job)

func (*WorkloadSpreadTester) WaiteCloneSetUpdate added in v0.10.1

func (t *WorkloadSpreadTester) WaiteCloneSetUpdate(cloneSet *appsv1alpha1.CloneSet)

func (*WorkloadSpreadTester) WaiteDeploymentUpdate added in v0.10.1

func (t *WorkloadSpreadTester) WaiteDeploymentUpdate(deployment *appsv1.Deployment)

Directories

Path Synopsis
Package testfiles provides a wrapper around various optional ways of retrieving additional files needed during a test run: - builtin bindata - filesystem access
Package testfiles provides a wrapper around various optional ways of retrieving additional files needed during a test run: - builtin bindata - filesystem access

Jump to

Keyboard shortcuts

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