Documentation ¶
Index ¶
- Constants
- Variables
- func AllNodesReady(c clientset.Interface, timeout time.Duration) error
- func CreateTestingNS(baseName string, c clientset.Interface, labels map[string]string) (*v1.Namespace, error)
- func DumpAllNamespaceInfo(c clientset.Interface, namespace string)
- func DumpEventsInNamespace(eventsLister EventsLister, namespace string)
- func DumpNodeDebugInfo(c clientset.Interface, nodeNames []string, ...)
- func ExpectNoError(err error, explain ...interface{})
- func Failf(format string, args ...interface{})
- func GetKubeletPods(c clientset.Interface, node string) (*v1.PodList, error)
- func GetNodeCondition(status *v1.NodeStatus, conditionType v1.NodeConditionType) (int, *v1.NodeCondition)
- func GetPodCondition(status *v1.PodStatus, conditionType v1.PodConditionType) (int, *v1.PodCondition)
- func GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition
- func IsNodeConditionSetAsExpected(node *v1.Node, conditionType v1.NodeConditionType, wantTrue bool) bool
- func IsNodeConditionSetAsExpectedSilent(node *v1.Node, conditionType v1.NodeConditionType, wantTrue bool) bool
- func IsPodReady(pod *v1.Pod) bool
- func IsPodReadyConditionTrue(status v1.PodStatus) bool
- func KubeDescribe(text string, body func()) bool
- func LoadConfig() (*restclient.Config, error)
- func Logf(format string, args ...interface{})
- func NodeProxyRequest(c clientset.Interface, node, endpoint string) (restclient.Result, error)
- func PodRunning(event watch.Event) (bool, error)
- func RegisterClusterFlags()
- func RegisterCommonFlags()
- func RegisterNodeFlags()
- func RemoveCleanupAction(p CleanupActionHandle)
- func RunCleanupActions()
- func ServerVersionGTE(v semver.Version, c discovery.ServerVersionInterface) (bool, error)
- func SingleObject(meta v1.ObjectMeta) v1.ListOptions
- func ViperizeFlags()
- func WaitForDeploymentPodsRunning(c clientset.Interface, ns, name string) error
- func WaitForPersistentVolumeClaimPhase(phase v1.PersistentVolumeClaimPhase, c clientset.Interface, ns string, ...) error
- func WaitForPersistentVolumeDeleted(c clientset.Interface, pvName string, Poll, timeout time.Duration) error
- func WaitForPodRunningInNamespace(c clientset.Interface, pod *v1.Pod) error
- func WaitForPodSuccessInNamespace(c clientset.Interface, podName string, namespace string) error
- func WaitForPodSuccessInNamespaceSlow(c clientset.Interface, podName string, namespace string) error
- func WaitForPodToDisappear(c clientset.Interface, ns, podName string, label labels.Selector, ...) error
- func WaitForPodsWithLabelRunning(c clientset.Interface, ns string, label labels.Selector) error
- type CleanupActionHandle
- type CloudConfig
- type CreateTestingNSFn
- type EventsLister
- type Framework
- type FrameworkOptions
- type NodeTestContextType
- type TestContextType
- type TestDataSummary
Constants ¶
const ( // 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 // How often to Poll pods, nodes and claims. Poll = 2 * time.Second // How long claims have to become dynamically provisioned ClaimProvisionTimeout = 5 * time.Minute )
Variables ¶
var ErrPodCompleted = fmt.Errorf("pod ran to completion")
ErrPodCompleted is returned by PodRunning or PodContainerRunning to indicate that the pod has already reached completed state.
var ( // Label allocated to the image puller static pod that runs on each node // before e2es. ImagePullerLabels = map[string]string{"name": "e2e-image-puller"} )
var RunId = uuid.NewUUID()
unique identifier of the e2e run
Functions ¶
func 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 CreateTestingNS ¶
func CreateTestingNS(baseName string, c clientset.Interface, labels map[string]string) (*v1.Namespace, error)
CreateTestingNS should be used by every test, note that we append a common prefix to the provided test name. Please see NewFramework instead of using this directly.
func DumpAllNamespaceInfo ¶
func DumpEventsInNamespace ¶
func DumpEventsInNamespace(eventsLister EventsLister, namespace string)
func DumpNodeDebugInfo ¶
func ExpectNoError ¶
func ExpectNoError(err error, explain ...interface{})
func GetKubeletPods ¶
GetKubeletPods retrieves the list of pods on the kubelet
func GetNodeCondition ¶
func GetNodeCondition(status *v1.NodeStatus, conditionType v1.NodeConditionType) (int, *v1.NodeCondition)
GetNodeCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.
func GetPodCondition ¶
func GetPodCondition(status *v1.PodStatus, conditionType v1.PodConditionType) (int, *v1.PodCondition)
GetPodCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.
func GetPodReadyCondition ¶
func GetPodReadyCondition(status v1.PodStatus) *v1.PodCondition
Extracts the pod ready condition from the given status and returns that. Returns nil if the condition is not present.
func IsPodReady ¶
IsPodReady returns true if a pod is ready; false otherwise.
func IsPodReadyConditionTrue ¶
IsPodReady retruns true if a pod is ready; false otherwise.
func KubeDescribe ¶
Wrapper function for ginkgo describe. Adds namespacing. TODO: Support type safe tagging as well https://github.com/kubernetes/kubernetes/pull/22401.
func LoadConfig ¶
func LoadConfig() (*restclient.Config, error)
func NodeProxyRequest ¶
NodeProxyRequest performs a get on a node proxy endpoint given the nodename and rest client.
func PodRunning ¶
PodRunning returns true if the pod is running, false if the pod has not yet reached running state, returns ErrPodCompleted if the pod has run to completion, or an error in any other case.
func RegisterClusterFlags ¶
func RegisterClusterFlags()
Register flags specific to the cluster e2e test suite.
func RegisterNodeFlags ¶
func RegisterNodeFlags()
Register flags specific to the node e2e test suite.
func RemoveCleanupAction ¶
func RemoveCleanupAction(p CleanupActionHandle)
RemoveCleanupAction removes a function that was installed by AddCleanupAction.
func RunCleanupActions ¶
func RunCleanupActions()
RunCleanupActions runs all functions installed by AddCleanupAction. It does not remove them (see RemoveCleanupAction) but it does run unlocked, so they may remove themselves.
func ServerVersionGTE ¶
ServerVersionGTE returns true if v is greater than or equal to the server version.
TODO(18726): This should be incorporated into client.VersionInterface.
func SingleObject ¶
func SingleObject(meta v1.ObjectMeta) v1.ListOptions
SingleObject returns a ListOptions for watching a single object.
func ViperizeFlags ¶
func ViperizeFlags()
ViperizeFlags sets up all flag and config processing. Future configuration info should be added to viper, not to flags.
func WaitForPersistentVolumeClaimPhase ¶
func WaitForPersistentVolumeClaimPhase(phase v1.PersistentVolumeClaimPhase, c clientset.Interface, ns string, pvcName string, Poll, timeout time.Duration) error
WaitForPersistentVolumeClaimPhase waits for a PersistentVolumeClaim to be in a specific phase or until timeout occurs, whichever comes first.
func WaitForPersistentVolumeDeleted ¶
func WaitForPersistentVolumeDeleted(c clientset.Interface, pvName string, Poll, timeout time.Duration) error
WaitForPersistentVolumeDeleted waits for a PersistentVolume to get deleted or until timeout occurs, whichever comes first.
func 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 WaitForPodSuccessInNamespace ¶
WaitForPodSuccessInNamespace returns nil if the pod reached state success, or an error if it reached failure or until podStartupTimeout.
func WaitForPodSuccessInNamespaceSlow ¶
func WaitForPodSuccessInNamespaceSlow(c clientset.Interface, podName string, namespace string) error
WaitForPodSuccessInNamespaceSlow returns nil if the pod reached state success, or an error if it reached failure or until slowPodStartupTimeout.
func WaitForPodToDisappear ¶
Types ¶
type CleanupActionHandle ¶
type CleanupActionHandle *int
func AddCleanupAction ¶
func AddCleanupAction(fn func()) CleanupActionHandle
AddCleanupAction installs a function that will be called in the event of the whole test being terminated. This allows arbitrary pieces of the overall test to hook into SynchronizedAfterSuite().
type CloudConfig ¶
type CreateTestingNSFn ¶
type EventsLister ¶
type Framework ¶
type Framework struct { BaseName string ClientSet clientset.Interface ClientPool dynamic.ClientPool Namespace *v1.Namespace // Every test has at least one namespace NamespaceDeletionTimeout time.Duration // 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 ¶
NewFramework 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 FrameworkOptions, client clientset.Interface) *Framework
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.
type FrameworkOptions ¶
type FrameworkOptions struct { ClientQPS float32 ClientBurst int GroupVersion *unversioned.GroupVersion }
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 // KubeletConfig is the kubelet configuration the test is running against. KubeletConfig componentconfig.KubeletConfiguration }
NodeTestContextType is part of TestContextType, it is shared by all node e2e test.
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 Provider 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 UpgradeTarget string UpgradeImage string PrometheusPushGateway string ContainerRuntime 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 bool // Currently supported values are 'hr' for human-readable and 'json'. It's a comma separated list. OutputPrintType string // 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 // If the garbage collector is enabled in the kube-apiserver and kube-controller-manager. GarbageCollectorEnabled bool // FeatureGates is a set of key=value pairs that describe feature gates for alpha/experimental features. FeatureGates string // Node e2e specific test context NodeTestContextType Viper string Cadvisor struct { MaxRetries int SleepDurationMS int } LoggingSoak struct { Scale int MilliSecondsBetweenWaves int } }
var TestContext TestContextType