Documentation ¶
Overview ¶
Package framework contains provider-independent helper code for building and running E2E tests with Ginkgo. The actual Ginkgo test suites gets assembled by combining this framework, the optional provider support code and specific tests via a separate .go file like Kubernetes' test/e2e.go.
Index ¶
- Constants
- Variables
- func AddOrUpdateAvoidPodOnNode(c clientset.Interface, nodeName string, avoidPods v1.AvoidPods)
- func AddOrUpdateLabelOnNode(c clientset.Interface, nodeName string, labelKey, labelValue string)
- func AddOrUpdateLabelOnNodeAndReturnOldValue(c clientset.Interface, nodeName string, labelKey, labelValue string) string
- func AddOrUpdateTaintOnNode(c clientset.Interface, nodeName string, taint v1.Taint)
- func AfterReadingAllFlags(t *TestContextType)
- func AfterSuiteActions()
- func AllNodesReady(c clientset.Interface, timeout time.Duration) error
- func AssertCleanup(ns string, selectors ...string)
- func BlockNetwork(from string, to string)
- func CheckConnectivityToHost(f *Framework, nodeName, podName, host string, pingCmd PingCommand, timeout int) error
- func CheckForControllerManagerHealthy(duration time.Duration) error
- func CheckInvariants(events []watch.Event, fns ...InvariantFunc) error
- func CheckReachabilityFromPod(expectToBeReachable bool, timeout time.Duration, namespace, pod, target string)
- func CheckTestingNSDeletedExcept(c clientset.Interface, skip string) error
- func Cleanup(filePath, ns string, selectors ...string)
- func CleanupSuite()
- func ConformanceIt(text string, body interface{}, timeout ...float64) bool
- func ContainerInitInvariant(older, newer runtime.Object) error
- func CoreDump(dir string)
- func CreateClientPod(c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim) (*v1.Pod, error)
- func CreateEmptyFileOnPod(namespace string, podName string, filePath string) error
- func CreateManagedInstanceGroup(size int64, zone, template string) error
- func CreateNginxPod(client clientset.Interface, namespace string, nodeSelector map[string]string, ...) (*v1.Pod, error)
- func CreatePDWithRetry() (string, error)
- func CreatePDWithRetryAndZone(zone string) (string, error)
- func CreatePV(c clientset.Interface, pv *v1.PersistentVolume) (*v1.PersistentVolume, error)
- func CreatePVC(c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim) (*v1.PersistentVolumeClaim, error)
- func CreatePVCPV(c clientset.Interface, pvConfig PersistentVolumeConfig, ...) (*v1.PersistentVolume, *v1.PersistentVolumeClaim, error)
- func CreatePVPVC(c clientset.Interface, pvConfig PersistentVolumeConfig, ...) (*v1.PersistentVolume, *v1.PersistentVolumeClaim, error)
- func CreatePVSource(zone string) (*v1.PersistentVolumeSource, error)
- func CreatePVsPVCs(numpvs, numpvcs int, c clientset.Interface, ns string, ...) (PVMap, PVCMap, error)
- func CreatePod(client clientset.Interface, namespace string, nodeSelector map[string]string, ...) (*v1.Pod, error)
- func CreateSecPod(client clientset.Interface, namespace string, ...) (*v1.Pod, error)
- func CreateSecPodWithNodeSelection(client clientset.Interface, namespace string, ...) (*v1.Pod, error)
- func CreateTestingNS(baseName string, c clientset.Interface, labels map[string]string) (*v1.Namespace, error)
- func CreateUnschedulablePod(client clientset.Interface, namespace string, nodeSelector map[string]string, ...) (*v1.Pod, error)
- func CreateWaitAndDeletePod(f *Framework, c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim) (err error)
- func DeleteManagedInstanceGroup(zone string) error
- func DeleteNamespaces(c clientset.Interface, deleteFilter, skipFilter []string) ([]string, error)
- func DeleteNodeOnCloudProvider(node *v1.Node) error
- func DeletePDWithRetry(diskName string) error
- func DeletePVCandValidatePV(c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim, ...) error
- func DeletePVCandValidatePVGroup(c clientset.Interface, ns string, pvols PVMap, claims PVCMap, ...) error
- func DeletePVSource(pvSource *v1.PersistentVolumeSource) error
- func DeletePersistentVolume(c clientset.Interface, pvName string) error
- func DeletePersistentVolumeClaim(c clientset.Interface, pvcName string, ns string) error
- func DeletePodWithWait(f *Framework, c clientset.Interface, pod *v1.Pod) error
- func DeletePodWithWaitByName(f *Framework, c clientset.Interface, podName, podNamespace string) error
- func DeleteRCAndWaitForGC(c clientset.Interface, ns, name string) error
- func DeleteResourceAndWaitForGC(c clientset.Interface, kind schema.GroupKind, ns, name string) error
- func DescribeIng(ns string)
- func DescribeItem(item interface{}) string
- func DsFromManifest(url string) (*appsv1.DaemonSet, error)
- func DumpAllNamespaceInfo(c clientset.Interface, namespace string)
- func DumpDebugInfo(c clientset.Interface, ns string)
- func DumpEventsInNamespace(eventsLister EventsLister, namespace string)
- func DumpNodeDebugInfo(c clientset.Interface, nodeNames []string, ...)
- func EnsureLoadBalancerResourcesDeleted(ip, portRange string) error
- func EtcdUpgrade(targetStorage, targetVersion string) error
- func ExpectEqual(actual interface{}, extra interface{}, explain ...interface{})
- func ExpectError(err error, 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 ExpectNodeHasLabel(c clientset.Interface, nodeName string, labelKey string, labelValue string)
- func ExpectNodeHasTaint(c clientset.Interface, nodeName string, taint *v1.Taint)
- func ExpectNotEqual(actual interface{}, extra interface{}, explain ...interface{})
- func GatherCPUProfile(componentName string, profileBaseName string, wg *sync.WaitGroup)
- func GatherCPUProfileForSeconds(componentName string, profileBaseName string, seconds int, wg *sync.WaitGroup)
- func GatherMemoryProfile(componentName string, profileBaseName string, wg *sync.WaitGroup)
- func GenerateMasterRegexp(prefix string) string
- func GetAllMasterAddresses(c clientset.Interface) []string
- func GetBoundPV(client clientset.Interface, pvc *v1.PersistentVolumeClaim) (*v1.PersistentVolume, error)
- func GetClusterZones(c clientset.Interface) (sets.String, error)
- func GetDefaultStorageClassName(c clientset.Interface) (string, error)
- func GetFileModeRegex(filePath string, mask *int32) string
- func GetGroupNodes(group string) ([]string, error)
- func GetHostAddress(client clientset.Interface, p *v1.Pod) (string, error)
- func GetHostExternalAddress(client clientset.Interface, p *v1.Pod) (externalAddress string, err error)
- func GetKubemarkMasterComponentsResourceUsage() map[string]*KubemarkResourceUsage
- func GetLogToFileFunc(file *os.File) func(format string, args ...interface{})
- func GetManagedInstanceGroupTemplateName(zone string) (string, error)
- func GetMasterHost() string
- func GetPodSecretUpdateTimeout(c clientset.Interface) time.Duration
- func GetProviders() []string
- func GetReadySchedulableNodesOrDie(c clientset.Interface) (nodes *v1.NodeList)
- func GroupSize(group string) (int, error)
- func HandleFlags()
- func KubeDescribe(text string, body func()) bool
- func KubectlCmd(args ...string) *exec.Cmd
- func KubectlVersion() (*utilversion.Version, error)
- func ListNamespaceEvents(c clientset.Interface, ns string) error
- func LoadClientset() (*clientset.Clientset, error)
- func LoadConfig() (*restclient.Config, error)
- func LogClusterImageSources()
- func LogFailedContainers(c clientset.Interface, ns string, ...)
- func LookForString(expectedString string, timeout time.Duration, fn func() string) (result string, err error)
- func LookForStringInFile(ns, podName, container, file, expectedString string, timeout time.Duration) (result string, err error)
- func LookForStringInLog(ns, podName, container, expectedString string, timeout time.Duration) (result string, err error)
- func LookForStringInPodExec(ns, podName string, command []string, expectedString string, ...) (result string, err error)
- func MakePersistentVolume(pvConfig PersistentVolumeConfig) *v1.PersistentVolume
- func MakePersistentVolumeClaim(cfg PersistentVolumeClaimConfig, ns string) *v1.PersistentVolumeClaim
- func MakePod(ns string, nodeSelector map[string]string, ...) *v1.Pod
- func MakeSecPod(ns string, pvclaims []*v1.PersistentVolumeClaim, ...) *v1.Pod
- func MakeWritePod(ns string, pvc *v1.PersistentVolumeClaim) *v1.Pod
- func MasterOSDistroIs(supportedMasterOsDistros ...string) bool
- func MasterUpgrade(v string) error
- func MasterUpgradeGCEWithKubeProxyDaemonSet(v string, enableKubeProxyDaemonSet bool) error
- func MigTemplate() (string, error)
- func NewE2ETestNodePreparer(client clientset.Interface, countToStrategy []testutils.CountToStrategy) testutils.TestNodePreparer
- func NodeHasTaint(c clientset.Interface, nodeName string, taint *v1.Taint) (bool, error)
- func NodeOSDistroIs(supportedNodeOsDistros ...string) bool
- func NodeUpgrade(f *Framework, v string, img string) error
- func NodeUpgradeGCEWithKubeProxyDaemonSet(f *Framework, v string, img string, enableKubeProxyDaemonSet bool) error
- func OpenWebSocketForURL(url *url.URL, config *restclient.Config, protocols []string) (*websocket.Conn, error)
- func PVPVCCleanup(c clientset.Interface, ns string, pv *v1.PersistentVolume, ...) []error
- func PVPVCMapCleanup(c clientset.Interface, ns string, pvols PVMap, claims PVCMap) []error
- func ParseKVLines(output, key string) string
- func PollURL(route, host string, timeout time.Duration, interval time.Duration, ...) error
- func PrettyPrint(item interface{}) string
- func PrintSummaries(summaries []TestDataSummary, testBaseName string)
- func ProviderIs(providers ...string) bool
- func ProxyMode(f *Framework) (string, error)
- func RandomSuffix() string
- func RcByNameContainer(name string, replicas int32, image string, labels map[string]string, ...) *v1.ReplicationController
- func RcByNamePort(name string, replicas int32, image string, containerArgs []string, port int, ...) *v1.ReplicationController
- func RegisterClusterFlags(flags *flag.FlagSet)
- func RegisterCommonFlags(flags *flag.FlagSet)
- func RegisterNodeFlags(flags *flag.FlagSet)
- func RegisterProvider(name string, factory Factory)
- func RemoveAvoidPodsOffNode(c clientset.Interface, nodeName string)
- func RemoveCleanupAction(p CleanupActionHandle)
- func RemoveLabelOffNode(c clientset.Interface, nodeName string, labelKey string)
- func RemoveTaintOffNode(c clientset.Interface, nodeName string, taint v1.Taint)
- func ResizeGroup(group string, size int32) error
- func RestartApiserver(cs clientset.Interface) error
- func RestartControllerManager() error
- func RestartKubeProxy(host string) error
- func RestartKubelet(host string) error
- func RestclientConfig(kubeContext string) (*clientcmdapi.Config, error)
- func RunCleanupActions()
- func RunCmd(command string, args ...string) (string, string, error)
- func RunCmdEnv(env []string, command string, args ...string) (string, string, error)
- func RunHostCmd(ns, name, cmd string) (string, error)
- func RunHostCmdOrDie(ns, name, cmd string) string
- func RunHostCmdWithRetries(ns, name, cmd string, interval, timeout time.Duration) (string, error)
- func RunIfContainerRuntimeIs(runtimes ...string)
- func RunIfSystemSpecNameIs(names ...string)
- func RunKubectl(args ...string) (string, error)
- func RunKubectlInput(data string, args ...string) (string, error)
- func RunKubectlOrDie(args ...string) string
- func RunKubectlOrDieInput(data string, args ...string) string
- func RunKubemciCmd(args ...string) (string, error)
- func RunKubemciWithKubeconfig(args ...string) (string, error)
- func RunRC(config testutils.RCConfig) error
- func ScaleRC(clientset clientset.Interface, scalesGetter scaleclient.ScalesGetter, ...) error
- func ScaleResource(clientset clientset.Interface, scalesGetter scaleclient.ScalesGetter, ...) error
- func ServerVersionGTE(v *utilversion.Version, c discovery.ServerVersionInterface) (bool, error)
- func SetAffinity(nodeSelection *NodeSelection, nodeName string)
- func SetAntiAffinity(nodeSelection *NodeSelection, nodeName string)
- func SetNodeAffinityRequirement(nodeSelection *NodeSelection, operator v1.NodeSelectorOperator, ...)
- func SetupSuite()
- func SimpleGET(c *http.Client, url, host string) (string, error)
- func SkipIfContainerRuntimeIs(runtimes ...string)
- func SkipIfMissingResource(dynamicClient dynamic.Interface, gvr schema.GroupVersionResource, ...)
- func SkipIfMultizone(c clientset.Interface)
- func SkipIfNoDefaultStorageClass(c clientset.Interface)
- func SkipIfProviderIs(unsupportedProviders ...string)
- func SkipUnlessAtLeast(value int, minValue int, message string)
- func SkipUnlessLocalEphemeralStorageEnabled()
- func SkipUnlessMasterOSDistroIs(supportedMasterOsDistros ...string)
- func SkipUnlessMultizone(c clientset.Interface)
- func SkipUnlessNodeCountIsAtLeast(minNodeCount int)
- func SkipUnlessNodeCountIsAtMost(maxNodeCount int)
- func SkipUnlessNodeOSDistroIs(supportedNodeOsDistros ...string)
- func SkipUnlessPrometheusMonitoringIsEnabled(supportedMonitoring ...string)
- func SkipUnlessProviderIs(supportedProviders ...string)
- func SkipUnlessSSHKeyPresent()
- func SkipUnlessServerVersionGTE(v *utilversion.Version, c discovery.ServerVersionInterface)
- func SkipUnlessTaintBasedEvictionsEnabled()
- func Skipf(format string, args ...interface{})
- func StartCPUProfileGatherer(componentName string, profileBaseName string, interval time.Duration) chan struct{}
- func StartCmdAndStreamOutput(cmd *exec.Cmd) (stdout, stderr io.ReadCloser, err error)
- func TestHitNodesFromOutside(externalIP string, httpPort int32, timeout time.Duration, ...) error
- func TestHitNodesFromOutsideWithCount(externalIP string, httpPort int32, timeout time.Duration, ...) error
- func TestUnderTemporaryNetworkFailure(c clientset.Interface, ns string, node *v1.Node, testFunc func())
- func TranslateIPv4ToIPv6(ip string) string
- func TryKill(cmd *exec.Cmd)
- func UnblockNetwork(from string, to string)
- func UpdateDaemonSetWithRetries(c clientset.Interface, namespace, name string, applyUpdate updateDSFunc) (ds *appsv1.DaemonSet, err error)
- func UpdateReplicationControllerWithRetries(c clientset.Interface, namespace, name string, applyUpdate updateRcFunc) (*v1.ReplicationController, error)
- func ValidateController(c clientset.Interface, containerImage string, replicas int, ...)
- func WaitAndVerifyBinds(c clientset.Interface, ns string, pvols PVMap, claims PVCMap, ...) error
- func WaitForAllNodesSchedulable(c clientset.Interface, timeout time.Duration) error
- func WaitForApiserverUp(c clientset.Interface) error
- func WaitForControllerManagerUp() error
- func WaitForDaemonSets(c clientset.Interface, ns string, allowedNotReadyNodes int32, ...) error
- func WaitForDefaultServiceAccountInNamespace(c clientset.Interface, namespace string) error
- func WaitForGroupSize(group string, size int32) error
- func WaitForKubeletUp(host string) error
- func WaitForMasters(masterPrefix string, c clientset.Interface, size int, timeout time.Duration) error
- func WaitForNamespacesDeleted(c clientset.Interface, namespaces []string, timeout time.Duration) error
- func WaitForNodeHasTaintOrNot(c clientset.Interface, nodeName string, taint *v1.Taint, wantTrue bool, ...) error
- func WaitForPVClaimBoundPhase(client clientset.Interface, pvclaims []*v1.PersistentVolumeClaim, ...) ([]*v1.PersistentVolume, error)
- func WaitForPersistentVolumeClaimDeleted(c clientset.Interface, ns string, pvcName string, Poll, timeout time.Duration) error
- func WaitForPersistentVolumeClaimPhase(phase v1.PersistentVolumeClaimPhase, c clientset.Interface, ns string, ...) error
- func WaitForPersistentVolumeClaimsPhase(phase v1.PersistentVolumeClaimPhase, c clientset.Interface, ns string, ...) error
- func WaitForPersistentVolumeDeleted(c clientset.Interface, pvName string, Poll, timeout time.Duration) error
- func WaitForPersistentVolumePhase(phase v1.PersistentVolumePhase, c clientset.Interface, pvName string, ...) error
- func WaitForRCPodToDisappear(c clientset.Interface, ns, rcName, podName string) error
- func WaitForRCToStabilize(c clientset.Interface, ns, name string, timeout time.Duration) error
- func WaitForReplicationController(c clientset.Interface, namespace, name string, exist bool, ...) error
- func WaitForReplicationControllerwithSelector(c clientset.Interface, namespace string, selector labels.Selector, exist bool, ...) error
- func WaitForService(c clientset.Interface, namespace, name string, exist bool, ...) error
- func WaitForServiceEndpointsNum(c clientset.Interface, namespace, serviceName string, expectNum int, ...) error
- func WaitForServiceWithSelector(c clientset.Interface, namespace string, selector labels.Selector, exist bool, ...) error
- func WaitForStableCluster(c clientset.Interface, masterNodes sets.String) int
- func WaitForStatefulSetReplicasReady(statefulSetName, ns string, c clientset.Interface, Poll, timeout time.Duration) error
- func WaitOnPVandPVC(c clientset.Interface, ns string, pv *v1.PersistentVolume, ...) error
- type CleanupActionHandle
- type ClientConfigGetter
- type CloudConfig
- type ClusterVerification
- type ContainerResourceGatherer
- type CreateTestingNSFn
- type E2ETestNodePreparer
- type EventsLister
- type ExecOptions
- type Factory
- type FlakeReport
- type Framework
- func (f *Framework) AddNamespacesToDelete(namespaces ...*v1.Namespace)
- func (f *Framework) AfterEach()
- func (f *Framework) BeforeEach()
- func (f *Framework) CheckFileSizeViaContainer(podName, containerName, path string) (string, error)
- func (f *Framework) CreateFromManifests(patch func(item interface{}) error, files ...string) (func(), error)
- func (f *Framework) CreateItems(items ...interface{}) (func(), error)
- func (f *Framework) CreateNamespace(baseName string, labels map[string]string) (*v1.Namespace, error)
- func (f *Framework) CreatePodsPerNodeForSimpleApp(appName string, podSpec func(n v1.Node) v1.PodSpec, maxCount int) map[string]string
- func (f *Framework) CreateServiceForSimpleApp(contPort, svcPort int, appName string) *v1.Service
- func (f *Framework) CreateServiceForSimpleAppWithPods(contPort int, svcPort int, appName string, podSpec func(n v1.Node) v1.PodSpec, ...) (*v1.Service, error)
- func (f *Framework) ExecCommandInContainer(podName, containerName string, cmd ...string) string
- func (f *Framework) ExecCommandInContainerWithFullOutput(podName, containerName string, cmd ...string) (string, string, error)
- func (f *Framework) ExecShellInContainer(podName, containerName string, cmd string) string
- func (f *Framework) ExecShellInPod(podName string, cmd string) string
- func (f *Framework) ExecShellInPodWithFullOutput(podName string, cmd string) (string, string, error)
- func (f *Framework) ExecWithOptions(options ExecOptions) (string, string, error)
- func (f *Framework) LoadFromManifests(files ...string) ([]interface{}, error)
- func (f *Framework) MatchContainerOutput(pod *v1.Pod, containerName string, expectedOutput []string, ...) error
- func (f *Framework) NewAgnhostPod(name string, args ...string) *v1.Pod
- func (f *Framework) NewClusterVerification(namespace *v1.Namespace, filter PodStateVerification) *ClusterVerification
- func (f *Framework) NewTestPod(name string, requests v1.ResourceList, limits v1.ResourceList) *v1.Pod
- func (f *Framework) PatchItems(items ...interface{}) error
- func (f *Framework) PatchName(item *string)
- func (f *Framework) PatchNamespace(item *string)
- func (f *Framework) PodClient() *PodClient
- func (f *Framework) PodClientNS(namespace string) *PodClient
- func (f *Framework) ReadFileViaContainer(podName, containerName string, path string) (string, error)
- func (f *Framework) RecordFlakeIfError(err error, optionalDescription ...interface{})
- func (f *Framework) TestContainerOutput(scenarioName string, pod *v1.Pod, containerIndex int, expectedOutput []string)
- func (f *Framework) TestContainerOutputRegexp(scenarioName string, pod *v1.Pod, containerIndex int, expectedOutput []string)
- func (f *Framework) WaitForPodNoLongerRunning(podName string) error
- func (f *Framework) WaitForPodNotFound(podName string, timeout time.Duration) error
- func (f *Framework) WaitForPodReady(podName string) error
- func (f *Framework) WaitForPodRunning(podName string) error
- func (f *Framework) WaitForPodRunningSlow(podName string) error
- func (f *Framework) WaitForPodTerminated(podName, reason string) error
- func (f *Framework) WriteFileViaContainer(podName, containerName string, path string, contents string) error
- type HTTPPokeParams
- type HTTPPokeResult
- type HTTPPokeStatus
- type InvariantFunc
- type ItemFactory
- type KubeCluster
- type KubeConfig
- type KubeUser
- 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 KubemarkResourceUsage
- type LogSizeDataTimeseries
- type LogSizeGatherer
- type LogsSizeData
- type LogsSizeDataSummary
- type LogsSizeVerifier
- type NetworkingTestConfig
- func (config *NetworkingTestConfig) DeleteNetProxyPod()
- func (config *NetworkingTestConfig) DeleteNodePortService()
- func (config *NetworkingTestConfig) DialFromContainer(protocol, containerIP, targetIP string, ...)
- func (config *NetworkingTestConfig) DialFromEndpointContainer(protocol, targetIP string, targetPort, maxTries, minTries int, ...)
- func (config *NetworkingTestConfig) DialFromNode(protocol, targetIP string, targetPort, maxTries, minTries int, ...)
- func (config *NetworkingTestConfig) DialFromTestContainer(protocol, targetIP string, targetPort, maxTries, minTries int, ...)
- func (config *NetworkingTestConfig) EndpointHostnames() sets.String
- func (config *NetworkingTestConfig) GetEndpointsFromContainer(protocol, containerIP, targetIP string, ...) (sets.String, error)
- func (config *NetworkingTestConfig) GetEndpointsFromTestContainer(protocol, targetIP string, targetPort, tries int) (sets.String, error)
- func (config *NetworkingTestConfig) GetSelfURL(port int32, path string, expected string)
- func (config *NetworkingTestConfig) GetSelfURLStatusCode(port int32, path string, expected string)
- type NodeKiller
- type NodeKillerConfig
- type NodeSelection
- type NodeTestContextType
- type NodesSet
- 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) (*v1.PersistentVolumeSource, error)
- func (n NullProvider) DeleteNode(node *v1.Node) error
- func (n NullProvider) DeletePD(pdName string) error
- func (n NullProvider) DeletePVSource(pvSource *v1.PersistentVolumeSource) error
- func (n NullProvider) EnableAndDisableInternalLB() (enable, disable func(svc *v1.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 Options
- type PVCMap
- type PVMap
- type PersistentVolumeClaimConfig
- type PersistentVolumeConfig
- type PingCommand
- type PodClient
- func (c *PodClient) Create(pod *v1.Pod) *v1.Pod
- func (c *PodClient) CreateBatch(pods []*v1.Pod) []*v1.Pod
- func (c *PodClient) CreateEventually(pod *v1.Pod, opts ...interface{}) *v1.Pod
- func (c *PodClient) CreateSync(pod *v1.Pod) *v1.Pod
- func (c *PodClient) CreateSyncInNamespace(pod *v1.Pod, namespace string) *v1.Pod
- func (c *PodClient) DeleteSync(name string, options *metav1.DeleteOptions, timeout time.Duration)
- func (c *PodClient) DeleteSyncInNamespace(name string, namespace string, options *metav1.DeleteOptions, ...)
- func (c *PodClient) MatchContainerOutput(name string, containerName string, expectedRegexp string) error
- func (c *PodClient) PodIsReady(name string) bool
- func (c *PodClient) Update(name string, updateFn func(pod *v1.Pod))
- func (c *PodClient) WaitForErrorEventOrSuccess(pod *v1.Pod) (*v1.Event, error)
- func (c *PodClient) WaitForFailure(name string, timeout time.Duration)
- func (c *PodClient) WaitForFinish(name string, timeout time.Duration)
- func (c *PodClient) WaitForSuccess(name string, timeout time.Duration)
- type PodStateVerification
- type ProviderInterface
- type ResourceConstraint
- type ResourceGathererOptions
- type ResourceUsageSummary
- type SingleContainerSummary
- type SingleLogSummary
- type TestContextType
- type TestDataSummary
- type TimestampedSize
- type UDPPokeParams
- type UDPPokeResult
- type UDPPokeStatus
- type What
- type WorkItem
Constants ¶
const ( // EndpointHTTPPort is an endpoint HTTP port for testing. EndpointHTTPPort = 8080 // EndpointUDPPort is an endpoint UDP port for testing. EndpointUDPPort = 8081 // ClusterHTTPPort is a cluster HTTP port for testing. ClusterHTTPPort = 80 // ClusterUDPPort is a cluster UDP port for testing. ClusterUDPPort = 90 // SessionAffinityChecks is number of checks to hit a given set of endpoints when enable session affinity. SessionAffinityChecks = 10 // RegexIPv4 is a regex to match IPv4 addresses RegexIPv4 = "(?:\\d+)\\.(?:\\d+)\\.(?:\\d+)\\.(?:\\d+)" // RegexIPv6 is a regex to match IPv6 addresses RegexIPv6 = "" /* 1910-byte string literal not displayed */ )
const ( // PodListTimeout is how long to wait for the pod to be listable. PodListTimeout = time.Minute // PodStartTimeout is how long to wait for the pod to be started. // 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 is 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 is how long to wait for the namespace to be deleted. // 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 is how long to wait for a service endpoint to be resolvable. ServiceStartTimeout = 3 * time.Minute // Poll is how often to Poll pods, nodes and claims. Poll = 2 * time.Second // PollShortTimeout is the short timeout value in polling. PollShortTimeout = 1 * time.Minute // ServiceAccountProvisionTimeout is how long to wait for a service account to be provisioned. // 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 is 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 is 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 is how long pods have to be "ready" when a test begins. PodReadyBeforeTimeout = 5 * time.Minute // ClaimProvisionTimeout is 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 is how long claims have to become bound. ClaimBindingTimeout = 3 * time.Minute // ClaimDeletingTimeout is How long claims have to become deleted. ClaimDeletingTimeout = 3 * time.Minute // PVReclaimingTimeout is how long PVs have to beome reclaimed. PVReclaimingTimeout = 3 * time.Minute // PVBindingTimeout is how long PVs have to become bound. PVBindingTimeout = 3 * time.Minute // PVDeletingTimeout is how long PVs have to become deleted. PVDeletingTimeout = 3 * time.Minute // RecreateNodeReadyAgainTimeout is how long a node is allowed to become "Ready" after it is recreated before // the test is considered failed. RecreateNodeReadyAgainTimeout = 10 * time.Minute // RestartNodeReadyAgainTimeout is how long a node is allowed to become "Ready" after it is restarted before // the test is considered failed. RestartNodeReadyAgainTimeout = 5 * time.Minute // RestartPodReadyAgainTimeout is how long a pod is allowed to become "running" and "ready" after a node // restart before test is considered failed. RestartPodReadyAgainTimeout = 5 * time.Minute // SnapshotCreateTimeout is how long for snapshot to create snapshotContent. SnapshotCreateTimeout = 5 * time.Minute )
const (
// DefaultCPUProfileSeconds is default value for how long the CPU profile is gathered for.
DefaultCPUProfileSeconds = 30
)
const ( // DefaultNamespaceDeletionTimeout is timeout duration for waiting for a namespace deletion. // TODO(mikedanese): reset this to 5 minutes once #47135 is resolved. // ref https://github.com/kubernetes/kubernetes/issues/47135 DefaultNamespaceDeletionTimeout = 10 * time.Minute )
const (
// DefaultNumNodes is the number of nodes. If not specified, then number of nodes is auto-detected
DefaultNumNodes = -1
)
const DefaultPodDeletionTimeout = 3 * time.Minute
DefaultPodDeletionTimeout is the default timeout for deleting pod
const NoCPUConstraint = math.MaxFloat64
NoCPUConstraint is the number of constraint for CPU.
const (
// VolumeSelectorKey is the key for volume selector.
VolumeSelectorKey = "e2e-pv-pool"
)
Variables ¶
var ( // BusyBoxImage is the image URI of BusyBox. BusyBoxImage = imageutils.GetE2EImage(imageutils.BusyBox) // ServeHostnameImage is a serve hostname image name. ServeHostnameImage = imageutils.GetE2EImage(imageutils.Agnhost) )
var ImageWhiteList sets.String
ImageWhiteList is the images used in the current test suite. It should be initialized in test suite and the images in the white list should be pre-pulled in the test suite. Currently, this is only used by node e2e test.
var NetexecImageName = imageutils.GetE2EImage(imageutils.Agnhost)
NetexecImageName is the image name for agnhost.
var ProvidersWithSSH = []string{"gce", "gke", "aws", "local"}
ProvidersWithSSH are those providers where each node is accessible with SSH
var RunID = uuid.NewUUID()
RunID is a unique identifier of the e2e run. Beware that this ID is not the same for all tests in the e2e run, because each Ginkgo node creates it separately.
var ( // SELinuxLabel is common selinux labels. SELinuxLabel = &v1.SELinuxOptions{ Level: "s0:c0,c1"} )
Functions ¶
func AddOrUpdateAvoidPodOnNode ¶ added in v1.7.0
AddOrUpdateAvoidPodOnNode adds avoidPods annotations to node, will override if it exists
func AddOrUpdateLabelOnNode ¶ added in v1.4.0
AddOrUpdateLabelOnNode adds the given label key and value to the given node or updates value.
func AddOrUpdateLabelOnNodeAndReturnOldValue ¶ added in v1.8.0
func AddOrUpdateLabelOnNodeAndReturnOldValue(c clientset.Interface, nodeName string, labelKey, labelValue string) string
AddOrUpdateLabelOnNodeAndReturnOldValue adds the given label key and value to the given node or updates value and returns the old label value.
func AddOrUpdateTaintOnNode ¶ added in v1.4.0
AddOrUpdateTaintOnNode adds the given taint to the given node or updates taint.
func AfterReadingAllFlags ¶ added in v1.7.0
func AfterReadingAllFlags(t *TestContextType)
AfterReadingAllFlags makes changes to the context after all flags have been read.
func AfterSuiteActions ¶ added in v1.16.0
func AfterSuiteActions()
AfterSuiteActions are actions that are run on ginkgo's SynchronizedAfterSuite
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 AssertCleanup ¶
AssertCleanup asserts that cleanup of a namespace wrt selectors occurred.
func BlockNetwork ¶
BlockNetwork blocks network between the given from value and the given to value. The following helper functions can block/unblock network from source host to destination host by manipulating iptable rules. This function assumes it can ssh to the source host.
Caution: Recommend to input IP instead of hostnames. Using hostnames will cause iptables to do a DNS lookup to resolve the name to an IP address, which will slow down the test and cause it to fail if DNS is absent or broken.
Suggested usage pattern:
func foo() { ... defer UnblockNetwork(from, to) BlockNetwork(from, to) ... }
func CheckConnectivityToHost ¶
func CheckConnectivityToHost(f *Framework, nodeName, podName, host string, pingCmd PingCommand, timeout int) error
CheckConnectivityToHost launches a pod to test connectivity to the specified host. An error will be returned if the host is not reachable from the pod.
An empty nodeName will use the schedule to choose where the pod is executed.
func CheckForControllerManagerHealthy ¶ added in v1.9.0
CheckForControllerManagerHealthy checks that the controller manager does not crash within "duration"
func CheckInvariants ¶
func CheckInvariants(events []watch.Event, fns ...InvariantFunc) error
CheckInvariants checks for invariant of the each events.
func CheckReachabilityFromPod ¶ added in v1.6.0
func CheckReachabilityFromPod(expectToBeReachable bool, timeout time.Duration, namespace, pod, target string)
CheckReachabilityFromPod checks reachability from the specified pod.
func CheckTestingNSDeletedExcept ¶
CheckTestingNSDeletedExcept checks whether all e2e based existing namespaces are in the Terminating state and waits until they are finally deleted. It ignores namespace skip.
func Cleanup ¶
Cleanup stops everything from filePath from namespace ns and checks if everything matching selectors from the given namespace is correctly stopped.
func CleanupSuite ¶ added in v1.16.0
func CleanupSuite()
CleanupSuite is the boilerplate that can be used after tests on ginkgo were run, on the SynchronizedAfterSuite step. Similar to SynchronizedBeforeSuite, we want to run some operations only once (such as collecting cluster logs). Here, the order of functions is reversed; first, the function which runs everywhere, and then the function that only runs on the first Ginkgo node.
func ConformanceIt ¶ added in v1.9.0
ConformanceIt is wrapper function for ginkgo It. Adds "[Conformance]" tag and makes static analysis easier.
func ContainerInitInvariant ¶
ContainerInitInvariant checks for an init containers are initialized and invariant on both older and newer.
func CoreDump ¶
func CoreDump(dir string)
CoreDump SSHs to the master and all nodes and dumps their logs into dir. It shells out to cluster/log-dump/log-dump.sh to accomplish this.
func CreateClientPod ¶ added in v1.6.0
func CreateClientPod(c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim) (*v1.Pod, error)
CreateClientPod defines and creates a pod with a mounted PV. Pod runs infinite loop until killed.
func CreateEmptyFileOnPod ¶ added in v1.7.0
CreateEmptyFileOnPod creates empty file at given path on the pod. TODO(alejandrox1): move to subpkg pod once kubectl methods have been refactored.
func CreateManagedInstanceGroup ¶ added in v1.10.0
CreateManagedInstanceGroup creates a Compute Engine managed instance group.
func CreateNginxPod ¶ added in v1.11.0
func CreateNginxPod(client clientset.Interface, namespace string, nodeSelector map[string]string, pvclaims []*v1.PersistentVolumeClaim) (*v1.Pod, error)
CreateNginxPod creates an enginx pod.
func CreatePDWithRetry ¶ added in v1.6.0
CreatePDWithRetry creates PD with retry.
func CreatePDWithRetryAndZone ¶ added in v1.7.0
CreatePDWithRetryAndZone creates PD on zone with retry.
func CreatePV ¶ added in v1.10.0
func CreatePV(c clientset.Interface, pv *v1.PersistentVolume) (*v1.PersistentVolume, error)
CreatePV creates the PV resource. Fails test on error.
func CreatePVC ¶ added in v1.6.0
func CreatePVC(c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim) (*v1.PersistentVolumeClaim, error)
CreatePVC creates the PVC resource. Fails test on error.
func CreatePVCPV ¶ added in v1.6.0
func CreatePVCPV(c clientset.Interface, pvConfig PersistentVolumeConfig, pvcConfig PersistentVolumeClaimConfig, ns string, preBind bool) (*v1.PersistentVolume, *v1.PersistentVolumeClaim, error)
CreatePVCPV creates a PVC followed by the PV based on the passed in nfs-server ip and namespace. If the "preBind" bool is true then pre-bind the PV to the PVC via the PV's ClaimRef. Return the pv and pvc to reflect the created objects. Note: in the pre-bind case the real PVC name, which is generated, is not
known until after the PVC is instantiated. This is why the pvc is created before the pv.
func CreatePVPVC ¶ added in v1.6.0
func CreatePVPVC(c clientset.Interface, pvConfig PersistentVolumeConfig, pvcConfig PersistentVolumeClaimConfig, ns string, preBind bool) (*v1.PersistentVolume, *v1.PersistentVolumeClaim, error)
CreatePVPVC creates a PV followed by the PVC based on the passed in nfs-server ip and namespace. If the "preBind" bool is true then pre-bind the PVC to the PV via the PVC's VolumeName. Return the pv and pvc to reflect the created objects. Note: in the pre-bind case the real PV name, which is generated, is not
known until after the PV is instantiated. This is why the pv is created before the pvc.
func CreatePVSource ¶ added in v1.7.0
func CreatePVSource(zone string) (*v1.PersistentVolumeSource, error)
CreatePVSource creates a PV source.
func CreatePVsPVCs ¶ added in v1.6.0
func CreatePVsPVCs(numpvs, numpvcs int, c clientset.Interface, ns string, pvConfig PersistentVolumeConfig, pvcConfig PersistentVolumeClaimConfig) (PVMap, PVCMap, error)
CreatePVsPVCs creates the desired number of PVs and PVCs and returns them in separate maps. If the number of PVs != the number of PVCs then the min of those two counts is the number of PVs expected to bind. If a Create error occurs, the returned maps may contain pv and pvc entries for the resources that were successfully created. In other words, when the caller sees an error returned, it needs to decide what to do about entries in the maps. Note: when the test suite deletes the namespace orphaned pvcs and pods are deleted. However,
orphaned pvs are not deleted and will remain after the suite completes.
func CreatePod ¶ added in v1.7.0
func CreatePod(client clientset.Interface, namespace string, nodeSelector map[string]string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string) (*v1.Pod, error)
CreatePod with given claims based on node selector
func CreateSecPod ¶ added in v1.8.0
func CreateSecPod(client clientset.Interface, namespace string, pvclaims []*v1.PersistentVolumeClaim, inlineVolumeSources []*v1.VolumeSource, isPrivileged bool, command string, hostIPC bool, hostPID bool, seLinuxLabel *v1.SELinuxOptions, fsGroup *int64, timeout time.Duration) (*v1.Pod, error)
CreateSecPod creates security pod with given claims
func CreateSecPodWithNodeSelection ¶ added in v1.15.0
func CreateSecPodWithNodeSelection(client clientset.Interface, namespace string, pvclaims []*v1.PersistentVolumeClaim, inlineVolumeSources []*v1.VolumeSource, isPrivileged bool, command string, hostIPC bool, hostPID bool, seLinuxLabel *v1.SELinuxOptions, fsGroup *int64, node NodeSelection, timeout time.Duration) (*v1.Pod, error)
CreateSecPodWithNodeSelection creates security pod with given claims
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 CreateUnschedulablePod ¶ added in v1.10.0
func CreateUnschedulablePod(client clientset.Interface, namespace string, nodeSelector map[string]string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string) (*v1.Pod, error)
CreateUnschedulablePod with given claims based on node selector
func CreateWaitAndDeletePod ¶ added in v1.6.0
func CreateWaitAndDeletePod(f *Framework, c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim) (err error)
CreateWaitAndDeletePod creates the test pod, wait for (hopefully) success, and then delete the pod. Note: need named return value so that the err assignment in the defer sets the returned error.
Has been shown to be necessary using Go 1.7.
func DeleteManagedInstanceGroup ¶ added in v1.10.0
DeleteManagedInstanceGroup deletes Google Compute Engine managed instance group.
func DeleteNamespaces ¶
DeleteNamespaces deletes all namespaces that match the given delete and skip filters. Filter is by simple strings.Contains; first skip filter, then delete filter. Returns the list of deleted namespaces or an error.
func DeleteNodeOnCloudProvider ¶ added in v1.14.0
DeleteNodeOnCloudProvider deletes the specified node.
func DeletePDWithRetry ¶ added in v1.6.0
DeletePDWithRetry deletes PD with retry.
func DeletePVCandValidatePV ¶ added in v1.6.0
func DeletePVCandValidatePV(c clientset.Interface, ns string, pvc *v1.PersistentVolumeClaim, pv *v1.PersistentVolume, expectPVPhase v1.PersistentVolumePhase) error
DeletePVCandValidatePV deletes the PVC and waits for the PV to enter its expected phase. Validate that the PV has been reclaimed (assumption here about reclaimPolicy). Caller tells this func which phase value to expect for the pv bound to the to-be-deleted claim.
func DeletePVCandValidatePVGroup ¶ added in v1.6.0
func DeletePVCandValidatePVGroup(c clientset.Interface, ns string, pvols PVMap, claims PVCMap, expectPVPhase v1.PersistentVolumePhase) error
DeletePVCandValidatePVGroup wraps deletePVCandValidatePV() by calling the function in a loop over the PV map. Only bound PVs are deleted. Validates that the claim was deleted and the PV is in the expected Phase (Released, Available, Bound). Note: if there are more claims than pvs then some of the remaining claims may bind to just made
available pvs.
func DeletePVSource ¶ added in v1.7.0
func DeletePVSource(pvSource *v1.PersistentVolumeSource) error
DeletePVSource deletes a PV source.
func DeletePersistentVolume ¶ added in v1.6.0
DeletePersistentVolume deletes the PV.
func DeletePersistentVolumeClaim ¶ added in v1.6.0
DeletePersistentVolumeClaim deletes the Claim.
func DeletePodWithWait ¶ added in v1.6.0
DeletePodWithWait deletes the passed-in pod and waits for the pod to be terminated. Resilient to the pod not existing.
func DeletePodWithWaitByName ¶ added in v1.10.8
func DeletePodWithWaitByName(f *Framework, c clientset.Interface, podName, podNamespace string) error
DeletePodWithWaitByName deletes the named and namespaced pod and waits for the pod to be terminated. Resilient to the pod not existing.
func DeleteRCAndWaitForGC ¶ added in v1.4.0
DeleteRCAndWaitForGC deletes only the Replication Controller and waits for GC to delete the pods.
func DeleteResourceAndWaitForGC ¶ added in v1.6.0
func DeleteResourceAndWaitForGC(c clientset.Interface, kind schema.GroupKind, ns, name string) error
DeleteResourceAndWaitForGC deletes only given resource and waits for GC to delete the pods.
func DescribeIng ¶ added in v1.6.0
func DescribeIng(ns string)
DescribeIng describes information of ingress by running kubectl describe ing.
func DescribeItem ¶ added in v1.13.0
func DescribeItem(item interface{}) string
DescribeItem always returns a string that describes the item, usually by calling out to cache.MetaNamespaceKeyFunc which concatenates namespace (if set) and name. If that fails, the entire item gets converted to a string.
func DsFromManifest ¶ added in v1.8.1
DsFromManifest reads a .json/yaml file and returns the daemonset in it.
func DumpAllNamespaceInfo ¶
DumpAllNamespaceInfo dumps events, pods and nodes information in the given namespace.
func DumpDebugInfo ¶ added in v1.8.0
DumpDebugInfo dumps debug info of tests.
func DumpEventsInNamespace ¶ added in v1.5.0
func DumpEventsInNamespace(eventsLister EventsLister, namespace string)
DumpEventsInNamespace dumps events in the given namespace.
func DumpNodeDebugInfo ¶
func DumpNodeDebugInfo(c clientset.Interface, nodeNames []string, logFunc func(fmt string, args ...interface{}))
DumpNodeDebugInfo dumps debug information of the given nodes.
func EnsureLoadBalancerResourcesDeleted ¶
EnsureLoadBalancerResourcesDeleted ensures that cloud load balancer resources that were created are actually cleaned up. Currently only implemented for GCE/GKE.
func EtcdUpgrade ¶ added in v1.5.4
EtcdUpgrade upgrades etcd on GCE.
func ExpectEqual ¶ added in v1.16.0
func ExpectEqual(actual interface{}, extra interface{}, explain ...interface{})
ExpectEqual expects the specified two are the same, otherwise an exception raises
func ExpectError ¶ added in v1.15.0
func ExpectError(err error, explain ...interface{})
ExpectError expects an error happens, otherwise an exception raises
func ExpectNoError ¶
func ExpectNoError(err error, explain ...interface{})
ExpectNoError checks if "err" is set, and if so, fails assertion while logging the error.
func ExpectNoErrorWithOffset ¶ added in v1.7.0
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 ¶ added in v1.4.0
ExpectNoErrorWithRetries checks if an error occurs with the given retry count.
func ExpectNodeHasLabel ¶ added in v1.4.0
ExpectNodeHasLabel expects that the given node has the given label pair.
func ExpectNodeHasTaint ¶ added in v1.4.0
ExpectNodeHasTaint expects that the node has the given taint.
func ExpectNotEqual ¶ added in v1.16.0
func ExpectNotEqual(actual interface{}, extra interface{}, explain ...interface{})
ExpectNotEqual expects the specified two are not the same, otherwise an exception raises
func GatherCPUProfile ¶ added in v1.12.0
GatherCPUProfile gathers CPU profile.
func GatherCPUProfileForSeconds ¶ added in v1.12.0
func GatherCPUProfileForSeconds(componentName string, profileBaseName string, seconds int, wg *sync.WaitGroup)
GatherCPUProfileForSeconds gathers CPU profile for specified seconds.
func GatherMemoryProfile ¶ added in v1.12.0
GatherMemoryProfile gathers memory profile.
func GenerateMasterRegexp ¶ added in v1.5.0
GenerateMasterRegexp returns a regex for matching master node name.
func GetAllMasterAddresses ¶ added in v1.13.0
GetAllMasterAddresses returns all IP addresses on which the kubelet can reach the master. It may return internal and external IPs, even if we expect for e.g. internal IPs to be used (issue #56787), so that we can be sure to block the master fully during tests.
func GetBoundPV ¶ added in v1.15.0
func GetBoundPV(client clientset.Interface, pvc *v1.PersistentVolumeClaim) (*v1.PersistentVolume, error)
GetBoundPV returns a PV details.
func GetClusterZones ¶ added in v1.7.16
GetClusterZones returns the values of zone label collected from all nodes.
func GetDefaultStorageClassName ¶ added in v1.15.0
GetDefaultStorageClassName returns default storageClass or return error
func GetFileModeRegex ¶ added in v1.14.0
GetFileModeRegex returns a file mode related regex which should be matched by the mounttest pods' output. If the given mask is nil, then the regex will contain the default OS file modes, which are 0644 for Linux and 0775 for Windows.
func GetGroupNodes ¶ added in v1.7.0
GetGroupNodes returns a node name for the specified node group
func GetHostAddress ¶ added in v1.16.0
GetHostAddress gets the node for a pod and returns the first address. Returns an error if the node the pod is on doesn't have an address.
func GetHostExternalAddress ¶
func GetHostExternalAddress(client clientset.Interface, p *v1.Pod) (externalAddress string, err error)
GetHostExternalAddress gets the node for a pod and returns the first External address. Returns an error if the node the pod is on doesn't have an External address.
func GetKubemarkMasterComponentsResourceUsage ¶ added in v1.6.0
func GetKubemarkMasterComponentsResourceUsage() map[string]*KubemarkResourceUsage
GetKubemarkMasterComponentsResourceUsage returns the resource usage of kubemark which contains multiple combinations of cpu and memory usage for each pod name. TODO: figure out how to move this to kubemark directory (need to factor test SSH out of e2e framework)
func GetLogToFileFunc ¶ added in v1.7.0
GetLogToFileFunc is a convenience function that returns a function that have the same interface as e2elog.Logf, but writes to a specified file.
func GetManagedInstanceGroupTemplateName ¶ added in v1.11.0
GetManagedInstanceGroupTemplateName returns the list of Google Compute Engine managed instance groups.
func GetPodSecretUpdateTimeout ¶ added in v1.8.0
GetPodSecretUpdateTimeout reuturns the timeout duration for updating pod secret.
func GetProviders ¶ added in v1.14.0
func GetProviders() []string
GetProviders returns the names of all currently registered providers.
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. TODO: remove this function here when references point to e2enode.
func HandleFlags ¶ added in v1.13.0
func HandleFlags()
HandleFlags sets up all flags and parses the command line.
func KubeDescribe ¶
KubeDescribe is wrapper function for ginkgo describe. Adds namespacing. TODO: Support type safe tagging as well https://github.com/kubernetes/kubernetes/pull/22401.
func KubectlCmd ¶
KubectlCmd runs the kubectl executable through the wrapper script.
func KubectlVersion ¶
func KubectlVersion() (*utilversion.Version, error)
KubectlVersion gets the version of kubectl that's currently being used (see --kubectl-path in e2e.go to use an alternate kubectl).
func ListNamespaceEvents ¶ added in v1.4.0
ListNamespaceEvents lists the events in the given namespace.
func LoadClientset ¶ added in v1.5.0
LoadClientset returns clientset for connecting to kubernetes clusters.
func LoadConfig ¶
func LoadConfig() (*restclient.Config, error)
LoadConfig returns a config for a rest client.
func LogClusterImageSources ¶ added in v1.5.8
func LogClusterImageSources()
LogClusterImageSources writes out cluster image sources.
func LogFailedContainers ¶
func LogFailedContainers(c clientset.Interface, ns string, logFunc func(ftm string, args ...interface{}))
LogFailedContainers runs `kubectl logs` on a failed containers.
func LookForString ¶
func LookForString(expectedString string, timeout time.Duration, fn func() string) (result string, err error)
LookForString looks for the given string in the output of fn, repeatedly calling fn until the timeout is reached or the string is found. Returns last log and possibly error if the string was not found. TODO(alejandrox1): move to pod/ subpkg once kubectl methods are refactored.
func LookForStringInFile ¶
func LookForStringInFile(ns, podName, container, file, expectedString string, timeout time.Duration) (result string, err error)
LookForStringInFile looks for the given string in a file in a specific pod container
func LookForStringInLog ¶
func LookForStringInLog(ns, podName, container, expectedString string, timeout time.Duration) (result string, err error)
LookForStringInLog looks for the given string in the log of a specific pod container
func LookForStringInPodExec ¶
func LookForStringInPodExec(ns, podName string, command []string, expectedString string, timeout time.Duration) (result string, err error)
LookForStringInPodExec looks for the given string in the output of a command executed in a specific pod container. TODO(alejandrox1): move to pod/ subpkg once kubectl methods are refactored.
func MakePersistentVolume ¶ added in v1.7.0
func MakePersistentVolume(pvConfig PersistentVolumeConfig) *v1.PersistentVolume
MakePersistentVolume returns a PV definition based on the nfs server IP. If the PVC is not nil then the PV is defined with a ClaimRef which includes the PVC's namespace. If the PVC is nil then the PV is not defined with a ClaimRef. If no reclaimPolicy is assigned, assumes "Retain". Specs are expected to match the test's PVC. Note: the passed-in claim does not have a name until it is created and thus the PV's
ClaimRef cannot be completely filled-in in this func. Therefore, the ClaimRef's name is added later in CreatePVCPV.
func MakePersistentVolumeClaim ¶ added in v1.6.0
func MakePersistentVolumeClaim(cfg PersistentVolumeClaimConfig, ns string) *v1.PersistentVolumeClaim
MakePersistentVolumeClaim returns a PVC API Object based on the PersistentVolumeClaimConfig.
func MakePod ¶ added in v1.6.0
func MakePod(ns string, nodeSelector map[string]string, pvclaims []*v1.PersistentVolumeClaim, isPrivileged bool, command string) *v1.Pod
MakePod returns a pod definition based on the namespace. The pod references the PVC's name. A slice of BASH commands can be supplied as args to be run by the pod
func MakeSecPod ¶ added in v1.8.0
func MakeSecPod(ns string, pvclaims []*v1.PersistentVolumeClaim, inlineVolumeSources []*v1.VolumeSource, isPrivileged bool, command string, hostIPC bool, hostPID bool, seLinuxLabel *v1.SELinuxOptions, fsGroup *int64) *v1.Pod
MakeSecPod returns a pod definition based on the namespace. The pod references the PVC's name. A slice of BASH commands can be supplied as args to be run by the pod. SELinux testing requires to pass HostIPC and HostPID as booleansi arguments.
func MakeWritePod ¶ added in v1.6.0
func MakeWritePod(ns string, pvc *v1.PersistentVolumeClaim) *v1.Pod
MakeWritePod returns a pod definition based on the namespace. The pod references the PVC's name.
func MasterOSDistroIs ¶ added in v1.8.0
MasterOSDistroIs returns true if the master OS distro is included in the supportedMasterOsDistros. Otherwise false.
func MasterUpgrade ¶
MasterUpgrade upgrades master node on GCE/GKE.
func MasterUpgradeGCEWithKubeProxyDaemonSet ¶ added in v1.8.0
MasterUpgradeGCEWithKubeProxyDaemonSet upgrades master node on GCE with enabling/disabling the daemon set of kube-proxy. TODO(mrhohn): Remove this function when kube-proxy is run as a DaemonSet by default.
func MigTemplate ¶
MigTemplate (GCE-only) returns the name of the MIG template that the nodes of the cluster use.
func NewE2ETestNodePreparer ¶ added in v1.5.0
func NewE2ETestNodePreparer(client clientset.Interface, countToStrategy []testutils.CountToStrategy) testutils.TestNodePreparer
NewE2ETestNodePreparer returns a new instance of E2ETestNodePreparer.
func NodeHasTaint ¶ added in v1.6.0
NodeHasTaint returns true if the node has the given taint, else returns false.
func NodeOSDistroIs ¶ added in v1.6.0
NodeOSDistroIs returns true if the node OS distro is included in the supportedNodeOsDistros. Otherwise false.
func NodeUpgrade ¶
NodeUpgrade upgrades nodes on GCE/GKE.
func NodeUpgradeGCEWithKubeProxyDaemonSet ¶ added in v1.8.0
func NodeUpgradeGCEWithKubeProxyDaemonSet(f *Framework, v string, img string, enableKubeProxyDaemonSet bool) error
NodeUpgradeGCEWithKubeProxyDaemonSet upgrades nodes on GCE with enabling/disabling the daemon set of kube-proxy. TODO(mrhohn): Remove this function when kube-proxy is run as a DaemonSet by default.
func OpenWebSocketForURL ¶
func OpenWebSocketForURL(url *url.URL, config *restclient.Config, protocols []string) (*websocket.Conn, error)
OpenWebSocketForURL constructs a websocket connection to the provided URL, using the client config, with the specified protocols.
func PVPVCCleanup ¶ added in v1.6.0
func PVPVCCleanup(c clientset.Interface, ns string, pv *v1.PersistentVolume, pvc *v1.PersistentVolumeClaim) []error
PVPVCCleanup cleans up a pv and pvc in a single pv/pvc test case. Note: delete errors are appended to []error so that we can attempt to delete both the pvc and pv.
func PVPVCMapCleanup ¶ added in v1.6.0
PVPVCMapCleanup Cleans up pvs and pvcs in multi-pv-pvc test cases. Entries found in the pv and claim maps are deleted as long as the Delete api call succeeds. Note: delete errors are appended to []error so that as many pvcs and pvs as possible are deleted.
func ParseKVLines ¶
ParseKVLines parses output that looks like lines containing "<key>: <val>" and returns <val> if <key> is found. Otherwise, it returns the empty string.
func PollURL ¶ added in v1.6.0
func PollURL(route, host string, timeout time.Duration, interval time.Duration, httpClient *http.Client, expectUnreachable bool) error
PollURL polls till the url responds with a healthy http code. If expectUnreachable is true, it breaks on first non-healthy http code instead.
func PrettyPrint ¶ added in v1.13.0
func PrettyPrint(item interface{}) string
PrettyPrint returns a human-readable representation of an item.
func PrintSummaries ¶ added in v1.7.0
func PrintSummaries(summaries []TestDataSummary, testBaseName string)
PrintSummaries prints summaries of tests.
func ProviderIs ¶
ProviderIs returns true if the provider is included is the providers. Otherwise false.
func RandomSuffix ¶ added in v1.14.0
func RandomSuffix() string
RandomSuffix provides a random string to append to pods,services,rcs. TODO: Allow service names to have the same form as names
for pods and replication controllers so we don't need to use such a function and can instead use the UUID utility function.
func RcByNameContainer ¶ added in v1.6.0
func RcByNameContainer(name string, replicas int32, image string, labels map[string]string, c v1.Container, gracePeriod *int64) *v1.ReplicationController
RcByNameContainer returns a ReplicationController with specified name and container
func RcByNamePort ¶ added in v1.6.0
func RcByNamePort(name string, replicas int32, image string, containerArgs []string, port int, protocol v1.Protocol, labels map[string]string, gracePeriod *int64) *v1.ReplicationController
RcByNamePort returns a ReplicationController with specified name and port
func RegisterClusterFlags ¶ added in v1.4.0
RegisterClusterFlags registers flags specific to the cluster e2e test suite.
func RegisterCommonFlags ¶ added in v1.4.0
RegisterCommonFlags registers flags common to all e2e test suites. The flag set can be flag.CommandLine (if desired) or a custom flag set that then gets passed to viperconfig.ViperizeFlags.
The other Register*Flags methods below can be used to add more test-specific flags. However, those settings then get added regardless whether the test is actually in the test suite.
For tests that have been converted to registering their options themselves, copy flags from test/e2e/framework/config as shown in HandleFlags.
func RegisterNodeFlags ¶ added in v1.4.0
RegisterNodeFlags registers flags specific to the node e2e test suite.
func RegisterProvider ¶ added in v1.13.0
RegisterProvider is expected to be called during application init, typically by an init function in a provider package.
func RemoveAvoidPodsOffNode ¶ added in v1.7.0
RemoveAvoidPodsOffNode removes AvoidPods annotations from the node. It does not fail if no such annotation exists.
func RemoveCleanupAction ¶
func RemoveCleanupAction(p CleanupActionHandle)
RemoveCleanupAction removes a function that was installed by AddCleanupAction.
func RemoveLabelOffNode ¶ added in v1.4.0
RemoveLabelOffNode is for cleaning up labels temporarily added to node, won't fail if target label doesn't exist or has been removed.
func RemoveTaintOffNode ¶ added in v1.4.0
RemoveTaintOffNode removes the given taint from the given node.
func ResizeGroup ¶ added in v1.7.0
ResizeGroup resizes an instance group
func RestartApiserver ¶
RestartApiserver restarts the kube-apiserver.
func RestartControllerManager ¶ added in v1.8.0
func RestartControllerManager() error
RestartControllerManager restarts the kube-controller-manager.
func RestartKubeProxy ¶
RestartKubeProxy restarts kube-proxy on the given host.
func RestartKubelet ¶ added in v1.8.0
RestartKubelet restarts kubelet on the given host.
func RestclientConfig ¶ added in v1.6.0
func RestclientConfig(kubeContext string) (*clientcmdapi.Config, error)
RestclientConfig returns a config holds the information needed to build connection to kubernetes clusters.
func RunCleanupActions ¶
func RunCleanupActions()
RunCleanupActions runs all functions installed by AddCleanupAction. It does not remove them (see RemoveCleanupAction) but it does run unlocked, so they may remove themselves.
func RunCmd ¶
RunCmd runs cmd using args and returns its stdout and stderr. It also outputs cmd's stdout and stderr to their respective OS streams.
func RunCmdEnv ¶ added in v1.5.4
RunCmdEnv runs cmd with the provided environment and args and returns its stdout and stderr. It also outputs cmd's stdout and stderr to their respective OS streams.
func RunHostCmd ¶
RunHostCmd runs the given cmd in the context of the given pod using `kubectl exec` inside of a shell.
func RunHostCmdOrDie ¶
RunHostCmdOrDie calls RunHostCmd and dies on error.
func RunHostCmdWithRetries ¶ added in v1.7.6
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 RunIfContainerRuntimeIs ¶ added in v1.6.8
func RunIfContainerRuntimeIs(runtimes ...string)
RunIfContainerRuntimeIs runs if the container runtime is included in the runtimes.
func RunIfSystemSpecNameIs ¶ added in v1.6.8
func RunIfSystemSpecNameIs(names ...string)
RunIfSystemSpecNameIs runs if the system spec name is included in the names.
func RunKubectl ¶
RunKubectl is a convenience wrapper over kubectlBuilder
func RunKubectlInput ¶ added in v1.14.0
RunKubectlInput is a convenience wrapper over kubectlBuilder that takes input to stdin
func RunKubectlOrDie ¶
RunKubectlOrDie is a convenience wrapper over kubectlBuilder
func RunKubectlOrDieInput ¶
RunKubectlOrDieInput is a convenience wrapper over kubectlBuilder that takes input to stdin
func RunKubemciCmd ¶ added in v1.11.0
RunKubemciCmd is a convenience wrapper over kubectlBuilder to run kubemci. It assumes that kubemci exists in PATH.
func RunKubemciWithKubeconfig ¶ added in v1.11.0
RunKubemciWithKubeconfig is a convenience wrapper over RunKubemciCmd
func RunRC ¶
RunRC Launches (and verifies correctness) of a Replication Controller and will wait for all pods it spawns to become "Running".
func ScaleRC ¶
func ScaleRC(clientset clientset.Interface, scalesGetter scaleclient.ScalesGetter, ns, name string, size uint, wait bool) error
ScaleRC scales Replication Controller to be desired size.
func ScaleResource ¶ added in v1.6.0
func ScaleResource( clientset clientset.Interface, scalesGetter scaleclient.ScalesGetter, ns, name string, size uint, wait bool, kind schema.GroupKind, gr schema.GroupResource, ) error
ScaleResource scales resource to the given size.
func ServerVersionGTE ¶
func ServerVersionGTE(v *utilversion.Version, c discovery.ServerVersionInterface) (bool, error)
ServerVersionGTE returns true if v is greater than or equal to the server version.
TODO(18726): This should be incorporated into client.VersionInterface.
func SetAffinity ¶ added in v1.15.0
func SetAffinity(nodeSelection *NodeSelection, nodeName string)
SetAffinity sets affinity to nodeName to nodeSelection
func SetAntiAffinity ¶ added in v1.15.0
func SetAntiAffinity(nodeSelection *NodeSelection, nodeName string)
SetAntiAffinity sets anti-affinity to nodeName to nodeSelection
func SetNodeAffinityRequirement ¶ added in v1.15.0
func SetNodeAffinityRequirement(nodeSelection *NodeSelection, operator v1.NodeSelectorOperator, nodeName string)
SetNodeAffinityRequirement sets affinity with specified operator to nodeName to nodeSelection
func SetupSuite ¶ added in v1.16.0
func SetupSuite()
SetupSuite is the boilerplate that can be used to setup ginkgo test suites, on the SynchronizedBeforeSuite step. There are certain operations we only want to run once per overall test invocation (such as deleting old namespaces, or verifying that all system pods are running. Because of the way Ginkgo runs tests in parallel, we must use SynchronizedBeforeSuite to ensure that these operations only run on the first parallel Ginkgo node.
This function takes two parameters: one function which runs on only the first Ginkgo node, returning an opaque byte array, and then a second function which runs on all Ginkgo nodes, accepting the byte array.
func SimpleGET ¶ added in v1.6.0
SimpleGET executes a get on the given url, returns error if non-200 returned.
func SkipIfContainerRuntimeIs ¶ added in v1.4.0
func SkipIfContainerRuntimeIs(runtimes ...string)
SkipIfContainerRuntimeIs skips if the container runtime is included in the runtimes.
func SkipIfMissingResource ¶ added in v1.4.1
func SkipIfMissingResource(dynamicClient dynamic.Interface, gvr schema.GroupVersionResource, namespace string)
SkipIfMissingResource skips if the gvr resource is missing.
func SkipIfMultizone ¶ added in v1.7.16
SkipIfMultizone skips if the cluster has multizone.
func SkipIfNoDefaultStorageClass ¶ added in v1.15.0
SkipIfNoDefaultStorageClass skips tests if no default SC can be found.
func SkipIfProviderIs ¶
func SkipIfProviderIs(unsupportedProviders ...string)
SkipIfProviderIs skips if the provider is included in the unsupportedProviders.
func SkipUnlessAtLeast ¶
SkipUnlessAtLeast skips if the value is less than the minValue.
func SkipUnlessLocalEphemeralStorageEnabled ¶ added in v1.9.0
func SkipUnlessLocalEphemeralStorageEnabled()
SkipUnlessLocalEphemeralStorageEnabled skips if the LocalStorageCapacityIsolation is not enabled.
func SkipUnlessMasterOSDistroIs ¶ added in v1.8.0
func SkipUnlessMasterOSDistroIs(supportedMasterOsDistros ...string)
SkipUnlessMasterOSDistroIs skips if the master OS distro is not included in the supportedMasterOsDistros.
func SkipUnlessMultizone ¶ added in v1.10.0
SkipUnlessMultizone skips if the cluster does not have multizone.
func SkipUnlessNodeCountIsAtLeast ¶
func SkipUnlessNodeCountIsAtLeast(minNodeCount int)
SkipUnlessNodeCountIsAtLeast skips if the number of nodes is less than the minNodeCount.
func SkipUnlessNodeCountIsAtMost ¶ added in v1.6.0
func SkipUnlessNodeCountIsAtMost(maxNodeCount int)
SkipUnlessNodeCountIsAtMost skips if the number of nodes is greater than the maxNodeCount.
func SkipUnlessNodeOSDistroIs ¶ added in v1.6.0
func SkipUnlessNodeOSDistroIs(supportedNodeOsDistros ...string)
SkipUnlessNodeOSDistroIs skips if the node OS distro is not included in the supportedNodeOsDistros.
func SkipUnlessPrometheusMonitoringIsEnabled ¶ added in v1.11.0
func SkipUnlessPrometheusMonitoringIsEnabled(supportedMonitoring ...string)
SkipUnlessPrometheusMonitoringIsEnabled skips if the prometheus monitoring is not enabled.
func SkipUnlessProviderIs ¶
func SkipUnlessProviderIs(supportedProviders ...string)
SkipUnlessProviderIs skips if the provider is not included in the supportedProviders.
func SkipUnlessSSHKeyPresent ¶ added in v1.6.4
func SkipUnlessSSHKeyPresent()
SkipUnlessSSHKeyPresent skips if no SSH key is found.
func SkipUnlessServerVersionGTE ¶
func SkipUnlessServerVersionGTE(v *utilversion.Version, c discovery.ServerVersionInterface)
SkipUnlessServerVersionGTE skips if the server version is less than v.
func SkipUnlessTaintBasedEvictionsEnabled ¶ added in v1.13.0
func SkipUnlessTaintBasedEvictionsEnabled()
SkipUnlessTaintBasedEvictionsEnabled skips if the TaintBasedEvictions is not enabled.
func Skipf ¶
func Skipf(format string, args ...interface{})
Skipf skips with information about why the test is being skipped.
func StartCPUProfileGatherer ¶ added in v1.12.0
func StartCPUProfileGatherer(componentName string, profileBaseName string, interval time.Duration) chan struct{}
StartCPUProfileGatherer performs polling-based gathering of the component's CPU profile. It takes the interval b/w consecutive gatherings as an argument and starts the gathering goroutine. To stop the gatherer, close the returned channel.
func StartCmdAndStreamOutput ¶
func StartCmdAndStreamOutput(cmd *exec.Cmd) (stdout, stderr io.ReadCloser, err error)
StartCmdAndStreamOutput returns stdout and stderr after starting the given cmd.
func TestHitNodesFromOutside ¶ added in v1.6.0
func TestHitNodesFromOutside(externalIP string, httpPort int32, timeout time.Duration, expectedHosts sets.String) error
TestHitNodesFromOutside checkes HTTP connectivity from outside.
func TestHitNodesFromOutsideWithCount ¶ added in v1.6.0
func TestHitNodesFromOutsideWithCount(externalIP string, httpPort int32, timeout time.Duration, expectedHosts sets.String, countToSucceed int) error
TestHitNodesFromOutsideWithCount checkes HTTP connectivity from outside with count.
func TestUnderTemporaryNetworkFailure ¶ added in v1.7.0
func TestUnderTemporaryNetworkFailure(c clientset.Interface, ns string, node *v1.Node, testFunc func())
TestUnderTemporaryNetworkFailure blocks outgoing network traffic on 'node'. Then runs testFunc and returns its status. At the end (even in case of errors), the network traffic is brought back to normal. This function executes commands on a node so it will work only for some environments.
func TranslateIPv4ToIPv6 ¶ added in v1.16.0
TranslateIPv4ToIPv6 maps an IPv4 address into a valid IPv6 address adding the well known prefix "0::ffff:" https://tools.ietf.org/html/rfc2765 if the ip is IPv4 and the cluster IPFamily is IPv6, otherwise returns the same ip
func TryKill ¶
TryKill is rough equivalent of ctrl+c for cleaning up processes. Intended to be run in defer.
func UnblockNetwork ¶
UnblockNetwork unblocks network between the given from value and the given to value.
func UpdateDaemonSetWithRetries ¶ added in v1.7.0
func UpdateDaemonSetWithRetries(c clientset.Interface, namespace, name string, applyUpdate updateDSFunc) (ds *appsv1.DaemonSet, err error)
UpdateDaemonSetWithRetries updates daemonsets with the given applyUpdate func until it succeeds or a timeout expires.
func UpdateReplicationControllerWithRetries ¶ added in v1.5.0
func UpdateReplicationControllerWithRetries(c clientset.Interface, namespace, name string, applyUpdate updateRcFunc) (*v1.ReplicationController, error)
UpdateReplicationControllerWithRetries retries updating the given rc on conflict with the following steps: 1. Get latest resource 2. applyUpdate 3. Update the resource
func ValidateController ¶
func ValidateController(c clientset.Interface, containerImage string, replicas int, containername string, testname string, validator validatorFn, ns string)
ValidateController is a generic mechanism for testing RC's that are running. It takes a container name, a test name, and a validator function which is plugged in by a specific test. "containername": this is grepped for. "containerImage" : this is the name of the image we expect to be launched. Not to confuse w/ images (kitten.jpg) which are validated. "testname": which gets bubbled up to the logging/failure messages if errors happen. "validator" function: This function is given a podID and a client, and it can do some specific validations that way.
func WaitAndVerifyBinds ¶ added in v1.6.0
func WaitAndVerifyBinds(c clientset.Interface, ns string, pvols PVMap, claims PVCMap, testExpected bool) error
WaitAndVerifyBinds searches for bound PVs and PVCs by examining pvols for non-nil claimRefs. NOTE: Each iteration waits for a maximum of 3 minutes per PV and, if the PV is bound,
up to 3 minutes for the PVC. When the number of PVs != number of PVCs, this can lead to situations where the maximum wait times are reached several times in succession, extending test time. Thus, it is recommended to keep the delta between PVs and PVCs small.
func WaitForAllNodesSchedulable ¶
WaitForAllNodesSchedulable waits up to timeout for all (but TestContext.AllowedNotReadyNodes) to become scheduable.
func WaitForApiserverUp ¶
WaitForApiserverUp waits for the kube-apiserver to be up.
func WaitForControllerManagerUp ¶ added in v1.8.0
func WaitForControllerManagerUp() error
WaitForControllerManagerUp waits for the kube-controller-manager to be up.
func WaitForDaemonSets ¶ added in v1.12.0
func WaitForDaemonSets(c clientset.Interface, ns string, allowedNotReadyNodes int32, timeout time.Duration) error
WaitForDaemonSets for all daemonsets in the given namespace to be ready (defined as all but 'allowedNotReadyNodes' pods associated with that daemonset are ready).
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 WaitForGroupSize ¶ added in v1.7.0
WaitForGroupSize waits for node instance group reached the desired size
func WaitForKubeletUp ¶ added in v1.8.0
WaitForKubeletUp waits for the kubelet on the given host to be up.
func WaitForMasters ¶ added in v1.5.0
func WaitForMasters(masterPrefix string, c clientset.Interface, size int, timeout time.Duration) error
WaitForMasters waits until the cluster has the desired number of ready masters in it.
func WaitForNamespacesDeleted ¶
func WaitForNamespacesDeleted(c clientset.Interface, namespaces []string, timeout time.Duration) error
WaitForNamespacesDeleted waits for the namespaces to be deleted.
func WaitForNodeHasTaintOrNot ¶ added in v1.13.0
func WaitForNodeHasTaintOrNot(c clientset.Interface, nodeName string, taint *v1.Taint, wantTrue bool, timeout time.Duration) error
WaitForNodeHasTaintOrNot waits for a taint to be added/removed from the node until timeout occurs, whichever comes first.
func WaitForPVClaimBoundPhase ¶ added in v1.7.0
func WaitForPVClaimBoundPhase(client clientset.Interface, pvclaims []*v1.PersistentVolumeClaim, timeout time.Duration) ([]*v1.PersistentVolume, error)
WaitForPVClaimBoundPhase waits until all pvcs phase set to bound
func WaitForPersistentVolumeClaimDeleted ¶ added in v1.10.0
func WaitForPersistentVolumeClaimDeleted(c clientset.Interface, ns string, pvcName string, Poll, timeout time.Duration) error
WaitForPersistentVolumeClaimDeleted waits for a PersistentVolumeClaim to be removed from the system until timeout occurs, whichever comes first.
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 WaitForPersistentVolumeClaimsPhase ¶ added in v1.13.0
func WaitForPersistentVolumeClaimsPhase(phase v1.PersistentVolumeClaimPhase, c clientset.Interface, ns string, pvcNames []string, Poll, timeout time.Duration, matchAny bool) error
WaitForPersistentVolumeClaimsPhase waits for any (if matchAny is true) or all (if matchAny is false) PersistentVolumeClaims 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 WaitForPersistentVolumePhase ¶
func WaitForPersistentVolumePhase(phase v1.PersistentVolumePhase, c clientset.Interface, pvName string, Poll, timeout time.Duration) error
WaitForPersistentVolumePhase waits for a PersistentVolume to be in a specific phase or until timeout occurs, whichever comes first.
func WaitForRCPodToDisappear ¶
WaitForRCPodToDisappear returns nil if the pod from the given replication controller (described by rcName) no longer exists. In case of failure or too long waiting time, an error is returned.
func WaitForRCToStabilize ¶
WaitForRCToStabilize waits till the RC has a matching generation/replica count between spec and status.
func WaitForReplicationController ¶
func WaitForReplicationController(c clientset.Interface, namespace, name string, exist bool, interval, timeout time.Duration) error
WaitForReplicationController waits until the RC appears (exist == true), or disappears (exist == false)
func WaitForReplicationControllerwithSelector ¶ added in v1.6.0
func WaitForReplicationControllerwithSelector(c clientset.Interface, namespace string, selector labels.Selector, exist bool, interval, timeout time.Duration) error
WaitForReplicationControllerwithSelector waits until any RC with given selector appears (exist == true), or disappears (exist == false)
func WaitForService ¶
func WaitForService(c clientset.Interface, namespace, name string, exist bool, interval, timeout time.Duration) error
WaitForService waits until the service appears (exist == true), or disappears (exist == false)
func WaitForServiceEndpointsNum ¶
func WaitForServiceEndpointsNum(c clientset.Interface, namespace, serviceName string, expectNum int, interval, timeout time.Duration) error
WaitForServiceEndpointsNum waits until the amount of endpoints that implement service to expectNum.
func WaitForServiceWithSelector ¶ added in v1.6.0
func WaitForServiceWithSelector(c clientset.Interface, namespace string, selector labels.Selector, exist bool, interval, timeout time.Duration) error
WaitForServiceWithSelector waits until any service with given selector appears (exist == true), or disappears (exist == false)
func WaitForStableCluster ¶ added in v1.4.0
WaitForStableCluster waits until all existing pods are scheduled and returns their amount.
func WaitForStatefulSetReplicasReady ¶ added in v1.10.0
func WaitForStatefulSetReplicasReady(statefulSetName, ns string, c clientset.Interface, Poll, timeout time.Duration) error
WaitForStatefulSetReplicasReady waits for all replicas of a StatefulSet to become ready or until timeout occurs, whichever comes first.
func WaitOnPVandPVC ¶ added in v1.6.0
func WaitOnPVandPVC(c clientset.Interface, ns string, pv *v1.PersistentVolume, pvc *v1.PersistentVolumeClaim) error
WaitOnPVandPVC waits for the pv and pvc to bind to each other.
Types ¶
type CleanupActionHandle ¶
type CleanupActionHandle *int
CleanupActionHandle is an integer pointer type for handling cleanup action
func AddCleanupAction ¶
func AddCleanupAction(fn func()) CleanupActionHandle
AddCleanupAction installs a function that will be called in the event of the whole test being terminated. This allows arbitrary pieces of the overall test to hook into SynchronizedAfterSuite().
type ClientConfigGetter ¶
type ClientConfigGetter func() (*restclient.Config, error)
ClientConfigGetter is a func that returns getter to return a 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 holds the cloud configuration for e2e test suites.
type ClusterVerification ¶
type ClusterVerification struct {
// contains filtered or unexported fields
}
ClusterVerification is a struct for a verification of cluster state.
func (*ClusterVerification) ForEach ¶
func (cl *ClusterVerification) ForEach(podFunc func(v1.Pod)) error
ForEach runs a function against every verifiable pod. Be warned that this doesn't wait for "n" pods to verify, so it may return very quickly if you have strict pod state requirements.
For example, if you require at least 5 pods to be running before your test will pass, its smart to first call "clusterVerification.WaitFor(5)" before you call clusterVerification.ForEach.
func (*ClusterVerification) WaitFor ¶
WaitFor waits for some minimum number of pods to be verified, according to the PodStateVerification definition.
func (*ClusterVerification) WaitForOrFail ¶
func (cl *ClusterVerification) WaitForOrFail(atLeast int, timeout time.Duration)
WaitForOrFail provides a shorthand WaitFor with failure as an option if anything goes wrong.
type ContainerResourceGatherer ¶ added in v1.10.0
type ContainerResourceGatherer struct {
// contains filtered or unexported fields
}
ContainerResourceGatherer is a struct for gathering container resource.
func NewResourceUsageGatherer ¶
func NewResourceUsageGatherer(c clientset.Interface, options ResourceGathererOptions, pods *v1.PodList) (*ContainerResourceGatherer, error)
NewResourceUsageGatherer returns a new ContainerResourceGatherer.
func (*ContainerResourceGatherer) StartGatheringData ¶ added in v1.10.0
func (g *ContainerResourceGatherer) StartGatheringData()
StartGatheringData starts a stat gathering worker blocks for each node to track, and blocks until StopAndSummarize is called.
func (*ContainerResourceGatherer) StopAndSummarize ¶ added in v1.10.0
func (g *ContainerResourceGatherer) StopAndSummarize(percentiles []int, constraints map[string]ResourceConstraint) (*ResourceUsageSummary, error)
StopAndSummarize stops stat gathering workers, processes the collected stats, generates resource summary for the passed-in percentiles, and returns the summary. It returns an error if the resource usage at any percentile is beyond the specified resource constraints.
type CreateTestingNSFn ¶
type CreateTestingNSFn func(baseName string, c clientset.Interface, labels map[string]string) (*v1.Namespace, error)
CreateTestingNSFn is a func that is responsible for creating namespace used for executing e2e tests.
type E2ETestNodePreparer ¶ added in v1.5.0
type E2ETestNodePreparer struct {
// contains filtered or unexported fields
}
E2ETestNodePreparer implements testutils.TestNodePreparer interface, which is used to create/modify Nodes before running a test.
func (*E2ETestNodePreparer) CleanupNodes ¶ added in v1.5.0
func (p *E2ETestNodePreparer) CleanupNodes() error
CleanupNodes cleanups nodes in the cluster.
func (*E2ETestNodePreparer) PrepareNodes ¶ added in v1.5.0
func (p *E2ETestNodePreparer) PrepareNodes() error
PrepareNodes prepares nodes in the cluster.
type EventsLister ¶ added in v1.5.0
EventsLister is a func that lists events.
type ExecOptions ¶ added in v1.5.0
type ExecOptions struct { Command []string Namespace string PodName string ContainerName string Stdin io.Reader CaptureStdout bool CaptureStderr bool // If false, whitespace in std{err,out} will be removed. PreserveWhitespace bool }
ExecOptions passed to ExecWithOptions
type Factory ¶ added in v1.13.0
type Factory func() (ProviderInterface, error)
Factory is a func which operates provider specific behavior.
type FlakeReport ¶ added in v1.12.0
type FlakeReport struct { Flakes []string `json:"flakes"` FlakeCount int `json:"flakeCount"` // contains filtered or unexported fields }
FlakeReport is a struct for managing the flake report.
func NewFlakeReport ¶ added in v1.12.0
func NewFlakeReport() *FlakeReport
NewFlakeReport returns a new flake report.
func (*FlakeReport) GetFlakeCount ¶ added in v1.12.0
func (f *FlakeReport) GetFlakeCount() int
GetFlakeCount returns the flake count.
func (*FlakeReport) PrintHumanReadable ¶ added in v1.12.0
func (f *FlakeReport) PrintHumanReadable() string
PrintHumanReadable returns string of flake report.
func (*FlakeReport) PrintJSON ¶ added in v1.12.0
func (f *FlakeReport) PrintJSON() string
PrintJSON returns the summary of frake report with JSON format.
func (*FlakeReport) RecordFlakeIfError ¶ added in v1.12.0
func (f *FlakeReport) RecordFlakeIfError(err error, optionalDescription ...interface{})
RecordFlakeIfError records the error (if non-nil) as a flake along with an optional description. This can be used as a replacement of framework.ExpectNoError() for non-critical errors that can be considered as 'flakes' to avoid causing failures in tests.
func (*FlakeReport) SummaryKind ¶ added in v1.12.0
func (f *FlakeReport) SummaryKind() string
SummaryKind returns the summary of flake report.
type Framework ¶
type Framework struct { BaseName string // Set together with creating the ClientSet and the namespace. // Guaranteed to be unique in the cluster even when running the same // test multiple times in parallel. UniqueName string ClientSet clientset.Interface KubemarkExternalClusterClientSet clientset.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 // Constraints that passed to a check which is executed after data is gathered to // see if 99% of results are within acceptable bounds. It has to be injected in the test, // as expectations vary greatly. Constraints are grouped by the container names. AddonResourceConstraints map[string]ResourceConstraint // 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 // contains filtered or unexported fields }
Framework supports common operations used by e2e tests; it will keep a client & a namespace for you. Eventual goal is to merge this with integration test framework.
func NewDefaultFramework ¶
NewDefaultFramework makes a new framework and sets up a BeforeEach/AfterEach for you (you can write additional before/after each functions).
func NewFramework ¶
NewFramework creates a test framework.
func (*Framework) AddNamespacesToDelete ¶ added in v1.11.0
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) CheckFileSizeViaContainer ¶ added in v1.4.6
CheckFileSizeViaContainer returns the list of file size under the specified path.
func (*Framework) CreateFromManifests ¶ added in v1.13.0
func (f *Framework) CreateFromManifests(patch func(item interface{}) error, files ...string) (func(), error)
CreateFromManifests is a combination of LoadFromManifests, PatchItems, patching with an optional custom function, and CreateItems.
func (*Framework) CreateItems ¶ added in v1.13.0
CreateItems creates the items. Each of them must be an API object of a type that is registered in Factory.
It returns either a cleanup function or an error, but never both.
Cleaning up after a test can be triggered in two ways:
- the test invokes the returned cleanup function, usually in an AfterEach
- the test suite terminates, potentially after skipping the test's AfterEach (https://github.com/onsi/ginkgo/issues/222)
PatchItems has the some limitations as LoadFromManifests: - only some common items are supported, unknown ones trigger an error - only the latest stable API version for each item is supported
func (*Framework) CreateNamespace ¶
func (f *Framework) CreateNamespace(baseName string, labels map[string]string) (*v1.Namespace, error)
CreateNamespace creates a namespace for e2e testing.
func (*Framework) CreatePodsPerNodeForSimpleApp ¶
func (f *Framework) CreatePodsPerNodeForSimpleApp(appName string, podSpec func(n v1.Node) v1.PodSpec, maxCount int) map[string]string
CreatePodsPerNodeForSimpleApp creates pods w/ labels. Useful for tests which make a bunch of pods w/o any networking.
func (*Framework) CreateServiceForSimpleApp ¶
CreateServiceForSimpleApp returns a service that selects/exposes pods (send -1 ports if no exposure needed) with an app label.
func (*Framework) CreateServiceForSimpleAppWithPods ¶
func (f *Framework) CreateServiceForSimpleAppWithPods(contPort int, svcPort int, appName string, podSpec func(n v1.Node) v1.PodSpec, count int, block bool) (*v1.Service, error)
CreateServiceForSimpleAppWithPods is a convenience wrapper to create a service and its matching pods all at once.
func (*Framework) ExecCommandInContainer ¶ added in v1.4.0
ExecCommandInContainer executes a command in the specified container.
func (*Framework) ExecCommandInContainerWithFullOutput ¶ added in v1.5.0
func (f *Framework) ExecCommandInContainerWithFullOutput(podName, containerName string, cmd ...string) (string, string, error)
ExecCommandInContainerWithFullOutput executes a command in the specified container and return stdout, stderr and error
func (*Framework) ExecShellInContainer ¶ added in v1.4.0
ExecShellInContainer executes the specified command on the pod's container.
func (*Framework) ExecShellInPod ¶ added in v1.4.0
ExecShellInPod executes the specified command on the pod.
func (*Framework) ExecShellInPodWithFullOutput ¶ added in v1.5.0
func (f *Framework) ExecShellInPodWithFullOutput(podName string, cmd string) (string, string, error)
ExecShellInPodWithFullOutput executes the specified command on the Pod and returns stdout, stderr and error.
func (*Framework) ExecWithOptions ¶ added in v1.5.0
func (f *Framework) ExecWithOptions(options ExecOptions) (string, string, error)
ExecWithOptions executes a command in the specified container, returning stdout, stderr and error. `options` allowed for additional parameters to be passed.
func (*Framework) LoadFromManifests ¶ added in v1.13.0
LoadFromManifests loads .yaml or .json manifest files and returns all items that it finds in them. It supports all items for which there is a factory registered in factories and .yaml files with multiple items separated by "---". Files are accessed via the "testfiles" package, which means they can come from a file system or be built into the binary.
LoadFromManifests has some limitations:
- aliases are not supported (i.e. use serviceAccountName instead of the deprecated serviceAccount, https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#podspec-v1-core) and silently ignored
- the latest stable API version for each item is used, regardless of what is specified in the manifest files
func (*Framework) MatchContainerOutput ¶ added in v1.4.0
func (f *Framework) MatchContainerOutput( pod *v1.Pod, containerName string, expectedOutput []string, matcher func(string, ...interface{}) gomegatypes.GomegaMatcher) error
MatchContainerOutput creates a pod and waits for all it's containers to exit with success. It then tests that the matcher with each expectedOutput matches the output of the specified container.
func (*Framework) NewAgnhostPod ¶ added in v1.15.0
NewAgnhostPod returns a pod that uses the agnhost image. The image's binary supports various subcommands that behave the same, no matter the underlying OS.
func (*Framework) NewClusterVerification ¶
func (f *Framework) NewClusterVerification(namespace *v1.Namespace, filter PodStateVerification) *ClusterVerification
NewClusterVerification creates a new cluster verification.
func (*Framework) NewTestPod ¶ added in v1.6.0
func (f *Framework) NewTestPod(name string, requests v1.ResourceList, limits v1.ResourceList) *v1.Pod
NewTestPod returns a pod that has the specified requests and limits
func (*Framework) PatchItems ¶ added in v1.13.0
PatchItems modifies the given items in place such that each test gets its own instances, to avoid conflicts between different tests and between tests and normal deployments.
This is done by: - creating namespaced items inside the test's namespace - changing the name of non-namespaced items like ClusterRole
PatchItems has some limitations: - only some common items are supported, unknown ones trigger an error - only the latest stable API version for each item is supported
func (*Framework) PatchName ¶ added in v1.13.0
PatchName makes the name of some item unique by appending the generated unique name.
func (*Framework) PatchNamespace ¶ added in v1.13.0
PatchNamespace moves the item into the test's namespace. Not all items can be namespaced. For those, the name also needs to be patched.
func (*Framework) PodClient ¶ added in v1.4.0
PodClient is a 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) PodClientNS ¶ added in v1.6.0
PodClientNS is a convenience method for getting a pod client interface in an alternative namespace, possibly applying test-suite specific transformations to the pod spec, e.g. for node e2e pod scheduling.
func (*Framework) ReadFileViaContainer ¶
func (f *Framework) ReadFileViaContainer(podName, containerName string, path string) (string, error)
ReadFileViaContainer reads a file using kubectl exec cat <path>.
func (*Framework) RecordFlakeIfError ¶ added in v1.12.0
RecordFlakeIfError records flakeness info if error happens. NOTE: This function is not used at any places yet, but we are in progress for https://github.com/kubernetes/kubernetes/issues/66239 which requires this. Please don't remove this.
func (*Framework) TestContainerOutput ¶
func (f *Framework) TestContainerOutput(scenarioName string, pod *v1.Pod, containerIndex int, expectedOutput []string)
TestContainerOutput runs the given pod in the given namespace and waits for all of the containers in the podSpec to move into the 'Success' status, and tests the specified container log against the given expected output using a substring matcher.
func (*Framework) TestContainerOutputRegexp ¶
func (f *Framework) TestContainerOutputRegexp(scenarioName string, pod *v1.Pod, containerIndex int, expectedOutput []string)
TestContainerOutputRegexp runs the given pod in the given namespace and waits for all of the containers in the podSpec to move into the 'Success' status, and tests the specified container log against the given expected output using a regexp matcher.
func (*Framework) WaitForPodNoLongerRunning ¶
WaitForPodNoLongerRunning waits for the pod to no longer be running in the namespace, for either success or failure.
func (*Framework) WaitForPodNotFound ¶ added in v1.9.0
WaitForPodNotFound waits for the pod to be completely terminated (not "Get-able").
func (*Framework) WaitForPodReady ¶
WaitForPodReady waits for the pod to flip to ready in the namespace.
func (*Framework) WaitForPodRunning ¶
WaitForPodRunning waits for the pod to run in the namespace.
func (*Framework) WaitForPodRunningSlow ¶
WaitForPodRunningSlow waits for the pod to run in the namespace. It has a longer timeout then WaitForPodRunning (util.slowPodStartTimeout).
func (*Framework) WaitForPodTerminated ¶
WaitForPodTerminated waits for the pod to be terminated with the given reason.
func (*Framework) WriteFileViaContainer ¶
func (f *Framework) WriteFileViaContainer(podName, containerName string, path string, contents string) error
WriteFileViaContainer writes a file using kubectl exec echo <contents> > <path> via specified container because of the primitive technique we're using here, we only allow ASCII alphanumeric characters
type HTTPPokeParams ¶ added in v1.13.6
type HTTPPokeParams struct { Timeout time.Duration ExpectCode int // default = 200 BodyContains string RetriableCodes []int }
HTTPPokeParams is a struct for HTTP poke parameters.
type HTTPPokeResult ¶ added in v1.13.6
type HTTPPokeResult struct { Status HTTPPokeStatus Code int // HTTP code: 0 if the connection was not made Error error // if there was any error Body []byte // if code != 0 }
HTTPPokeResult is a struct for HTTP poke result.
func PokeHTTP ¶ added in v1.13.6
func PokeHTTP(host string, port int, path string, params *HTTPPokeParams) HTTPPokeResult
PokeHTTP tries to connect to a host on a port for a given URL path. Callers can specify additional success parameters, if desired.
The result status will be characterized as precisely as possible, given the known users of this.
The result code will be zero in case of any failure to connect, or non-zero if the HTTP transaction completed (even if the other test params make this a failure).
The result error will be populated for any status other than Success.
The result body will be populated if the HTTP transaction was completed, even if the other test params make this a failure).
type HTTPPokeStatus ¶ added in v1.13.6
type HTTPPokeStatus string
HTTPPokeStatus is string for representing HTTP poke status.
const ( // HTTPSuccess is HTTP poke status which is success. HTTPSuccess HTTPPokeStatus = "Success" // HTTPError is HTTP poke status which is error. HTTPError HTTPPokeStatus = "UnknownError" // HTTPTimeout is HTTP poke status which is timeout. HTTPTimeout HTTPPokeStatus = "TimedOut" // HTTPRefused is HTTP poke status which is connection refused. HTTPRefused HTTPPokeStatus = "ConnectionRefused" // HTTPRetryCode is HTTP poke status which is retry code. HTTPRetryCode HTTPPokeStatus = "RetryCode" // HTTPWrongCode is HTTP poke status which is wrong code. HTTPWrongCode HTTPPokeStatus = "WrongCode" // HTTPBadResponse is HTTP poke status which is bad response. HTTPBadResponse HTTPPokeStatus = "BadResponse" )
type InvariantFunc ¶
InvariantFunc is a func that checks for invariant.
type ItemFactory ¶ added in v1.13.0
type ItemFactory interface { // New returns a new empty item. New() runtime.Object // Create is responsible for creating the item. It returns an // error or a cleanup function for the created item. // If the item is of an unsupported type, it must return // an error that has errorItemNotSupported as cause. Create(f *Framework, item interface{}) (func() error, error) }
ItemFactory provides support for creating one particular item. The type gets exported because other packages might want to extend the set of pre-defined factories.
type KubeCluster ¶
type KubeCluster struct { Name string `yaml:"name"` Cluster struct { CertificateAuthorityData string `yaml:"certificate-authority-data"` Server string `yaml:"server"` } `yaml:"cluster"` }
KubeCluster is a struct for managing kubernetes cluster info.
type KubeConfig ¶
type KubeConfig struct { Contexts []struct { Name string `yaml:"name"` Context struct { Cluster string `yaml:"cluster"` User string } `yaml:"context"` } `yaml:"contexts"` Clusters []KubeCluster `yaml:"clusters"` Users []KubeUser `yaml:"users"` }
KubeConfig is a struct for managing kubernetes config.
func (*KubeConfig) FindCluster ¶ added in v1.6.0
func (kc *KubeConfig) FindCluster(name string) *KubeCluster
FindCluster returns cluster info which is the specified cluster name.
func (*KubeConfig) FindUser ¶ added in v1.6.0
func (kc *KubeConfig) FindUser(name string) *KubeUser
FindUser returns user info which is the specified user name.
type KubeUser ¶
type KubeUser struct { Name string `yaml:"name"` User struct { Username string `yaml:"username"` Password string `yaml:"password"` Token string `yaml:"token"` } `yaml:"user"` }
KubeUser is a struct for managing kubernetes user info.
type KubectlBuilder ¶ added in v1.15.0
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 returns a KubectlBuilder for running kubectl.
func (KubectlBuilder) Exec ¶ added in v1.15.0
func (b KubectlBuilder) Exec() (string, error)
Exec runs the kubectl executable.
func (KubectlBuilder) ExecOrDie ¶ added in v1.15.0
func (b KubectlBuilder) ExecOrDie() string
ExecOrDie runs the kubectl executable or dies if error occurs.
func (*KubectlBuilder) WithEnv ¶ added in v1.15.0
func (b *KubectlBuilder) WithEnv(env []string) *KubectlBuilder
WithEnv sets the given environment and returns itself.
func (KubectlBuilder) WithStdinData ¶ added in v1.15.0
func (b KubectlBuilder) WithStdinData(data string) *KubectlBuilder
WithStdinData sets the given data to stdin and returns itself.
func (KubectlBuilder) WithStdinReader ¶ added in v1.15.0
func (b KubectlBuilder) WithStdinReader(reader io.Reader) *KubectlBuilder
WithStdinReader sets the given reader and returns itself.
func (*KubectlBuilder) WithTimeout ¶ added in v1.15.0
func (b *KubectlBuilder) WithTimeout(t <-chan time.Time) *KubectlBuilder
WithTimeout sets the given timeout and returns itself.
type KubemarkResourceUsage ¶ added in v1.6.0
type KubemarkResourceUsage struct { Name string MemoryWorkingSetInBytes uint64 CPUUsageInCores float64 }
KubemarkResourceUsage is a struct for tracking the resource usage of kubemark.
type LogSizeDataTimeseries ¶
type LogSizeDataTimeseries map[string]map[string][]TimestampedSize
LogSizeDataTimeseries is map of timestamped size.
type LogSizeGatherer ¶
type LogSizeGatherer struct {
// contains filtered or unexported fields
}
LogSizeGatherer is a worker which grabs a WorkItem from the channel and does assigned work.
func (*LogSizeGatherer) Work ¶
func (g *LogSizeGatherer) Work() bool
Work does a single unit of work: tries to take out a WorkItem from the queue, ssh-es into a given machine, gathers data, writes it to the shared <data> map, and creates a gorouting which reinserts work item into the queue with a <pollingPeriod> delay. Returns false if worker should exit.
type LogsSizeData ¶
type LogsSizeData struct {
// contains filtered or unexported fields
}
LogsSizeData is a structure for handling timeseries of log size data and lock.
type LogsSizeDataSummary ¶
type LogsSizeDataSummary map[string]map[string]SingleLogSummary
LogsSizeDataSummary is map of log summary. node -> file -> data
func (*LogsSizeDataSummary) PrintHumanReadable ¶
func (s *LogsSizeDataSummary) PrintHumanReadable() string
PrintHumanReadable returns string of log size data summary. TODO: make sure that we don't need locking here
func (*LogsSizeDataSummary) PrintJSON ¶
func (s *LogsSizeDataSummary) PrintJSON() string
PrintJSON returns the summary of log size data with JSON format.
func (*LogsSizeDataSummary) SummaryKind ¶ added in v1.7.0
func (s *LogsSizeDataSummary) SummaryKind() string
SummaryKind returns the summary of log size data summary.
type LogsSizeVerifier ¶
type LogsSizeVerifier struct {
// contains filtered or unexported fields
}
LogsSizeVerifier gathers data about log files sizes from master and node machines. It oversees a <workersNo> workers which do the gathering.
func NewLogsVerifier ¶
func NewLogsVerifier(c clientset.Interface, stopChannel chan bool) *LogsSizeVerifier
NewLogsVerifier creates a new LogsSizeVerifier which will stop when stopChannel is closed
func (*LogsSizeVerifier) GetSummary ¶
func (s *LogsSizeVerifier) GetSummary() *LogsSizeDataSummary
GetSummary returns a summary (average generation rate and number of probes) of the data gathered by LogSizeVerifier
func (*LogsSizeVerifier) Run ¶
func (s *LogsSizeVerifier) Run()
Run starts log size gathering. It starts a gorouting for every worker and then blocks until stopChannel is closed
type NetworkingTestConfig ¶ added in v1.5.0
type NetworkingTestConfig struct { // TestContaienrPod is a test pod running the netexec image. It is capable // of executing tcp/udp requests against ip:port. TestContainerPod *v1.Pod // HostTestContainerPod is a pod running using the hostexec image. HostTestContainerPod *v1.Pod // if the HostTestContainerPod is running with HostNetwork=true. HostNetwork bool // EndpointPods are the pods belonging to the Service created by this // test config. Each invocation of `setup` creates a service with // 1 pod per node running the netexecImage. EndpointPods []*v1.Pod // NodePortService is a Service with Type=NodePort spanning over all // endpointPods. NodePortService *v1.Service // SessionAffinityService is a Service with SessionAffinity=ClientIP // spanning over all endpointPods. SessionAffinityService *v1.Service // ExternalAddrs is a list of external IPs of nodes in the cluster. ExternalAddrs []string // Nodes is a list of nodes in the cluster. Nodes []v1.Node // MaxTries is the number of retries tolerated for tests run against // endpoints and services created by this config. MaxTries int // The ClusterIP of the Service reated by this test config. ClusterIP string // External ip of first node for use in nodePort testing. NodeIP string // The http/udp nodePorts of the Service. NodeHTTPPort int NodeUDPPort int // The kubernetes namespace within which all resources for this // config are created Namespace string // contains filtered or unexported fields }
NetworkingTestConfig is a convenience class around some utility methods for testing kubeproxy/networking/services/endpoints.
func NewCoreNetworkingTestConfig ¶ added in v1.5.0
func NewCoreNetworkingTestConfig(f *Framework, hostNetwork bool) *NetworkingTestConfig
NewCoreNetworkingTestConfig creates and sets up a new test config helper for Node E2E.
func NewNetworkingTestConfig ¶ added in v1.5.0
func NewNetworkingTestConfig(f *Framework) *NetworkingTestConfig
NewNetworkingTestConfig creates and sets up a new test config helper.
func (*NetworkingTestConfig) DeleteNetProxyPod ¶ added in v1.5.0
func (config *NetworkingTestConfig) DeleteNetProxyPod()
DeleteNetProxyPod deletes the first endpoint pod and waits for it being removed.
func (*NetworkingTestConfig) DeleteNodePortService ¶ added in v1.5.0
func (config *NetworkingTestConfig) DeleteNodePortService()
DeleteNodePortService deletes NodePort service.
func (*NetworkingTestConfig) DialFromContainer ¶ added in v1.5.0
func (config *NetworkingTestConfig) DialFromContainer(protocol, containerIP, targetIP string, containerHTTPPort, targetPort, maxTries, minTries int, expectedEps sets.String)
DialFromContainer executes a curl via kubectl exec in a test container, which might then translate to a tcp or udp request based on the protocol argument in the url.
- minTries is the minimum number of curl attempts required before declaring success. Set to 0 if you'd like to return as soon as all endpoints respond at least once.
- maxTries is the maximum number of curl attempts. If this many attempts pass and we don't see all expected endpoints, the test fails.
- expectedEps is the set of endpointnames to wait for. Typically this is also the hostname reported by each pod in the service through /hostName.
maxTries == minTries will confirm that we see the expected endpoints and no more for maxTries. Use this if you want to eg: fail a readiness check on a pod and confirm it doesn't show up as an endpoint.
func (*NetworkingTestConfig) DialFromEndpointContainer ¶ added in v1.5.0
func (config *NetworkingTestConfig) DialFromEndpointContainer(protocol, targetIP string, targetPort, maxTries, minTries int, expectedEps sets.String)
DialFromEndpointContainer executes a curl via kubectl exec in an endpoint container.
func (*NetworkingTestConfig) DialFromNode ¶ added in v1.5.0
func (config *NetworkingTestConfig) DialFromNode(protocol, targetIP string, targetPort, maxTries, minTries int, expectedEps sets.String)
DialFromNode executes a tcp or udp request based on protocol via kubectl exec in a test container running with host networking.
- minTries is the minimum number of curl attempts required before declaring success. Set to 0 if you'd like to return as soon as all endpoints respond at least once.
- maxTries is the maximum number of curl attempts. If this many attempts pass and we don't see all expected endpoints, the test fails.
maxTries == minTries will confirm that we see the expected endpoints and no more for maxTries. Use this if you want to eg: fail a readiness check on a pod and confirm it doesn't show up as an endpoint.
func (*NetworkingTestConfig) DialFromTestContainer ¶ added in v1.5.0
func (config *NetworkingTestConfig) DialFromTestContainer(protocol, targetIP string, targetPort, maxTries, minTries int, expectedEps sets.String)
DialFromTestContainer executes a curl via kubectl exec in a test container.
func (*NetworkingTestConfig) EndpointHostnames ¶ added in v1.5.0
func (config *NetworkingTestConfig) EndpointHostnames() sets.String
EndpointHostnames returns a set of hostnames for existing endpoints.
func (*NetworkingTestConfig) GetEndpointsFromContainer ¶ added in v1.9.0
func (config *NetworkingTestConfig) GetEndpointsFromContainer(protocol, containerIP, targetIP string, containerHTTPPort, targetPort, tries int) (sets.String, error)
GetEndpointsFromContainer executes a curl via kubectl exec in a test container, which might then translate to a tcp or udp request based on the protocol argument in the url. It returns all different endpoints from multiple retries.
- tries is the number of curl attempts. If this many attempts pass and we don't see any endpoints, the test fails.
func (*NetworkingTestConfig) GetEndpointsFromTestContainer ¶ added in v1.9.0
func (config *NetworkingTestConfig) GetEndpointsFromTestContainer(protocol, targetIP string, targetPort, tries int) (sets.String, error)
GetEndpointsFromTestContainer executes a curl via kubectl exec in a test container.
func (*NetworkingTestConfig) GetSelfURL ¶ added in v1.5.0
func (config *NetworkingTestConfig) GetSelfURL(port int32, path string, expected string)
GetSelfURL executes a curl against the given path via kubectl exec into a test container running with host networking, and fails if the output doesn't match the expected string.
func (*NetworkingTestConfig) GetSelfURLStatusCode ¶ added in v1.8.0
func (config *NetworkingTestConfig) GetSelfURLStatusCode(port int32, path string, expected string)
GetSelfURLStatusCode executes a curl against the given path via kubectl exec into a test container running with host networking, and fails if the returned status code doesn't match the expected string.
type NodeKiller ¶ added in v1.14.0
type NodeKiller struct {
// contains filtered or unexported fields
}
NodeKiller is a utility to simulate node failures.
func NewNodeKiller ¶ added in v1.14.0
func NewNodeKiller(config NodeKillerConfig, client clientset.Interface, provider string) *NodeKiller
NewNodeKiller creates new NodeKiller.
func (*NodeKiller) Run ¶ added in v1.14.0
func (k *NodeKiller) Run(stopCh <-chan struct{})
Run starts NodeKiller until stopCh is closed.
type NodeKillerConfig ¶ added in v1.14.0
type NodeKillerConfig struct { // Enabled determines whether NodeKill should do anything at all. // All other options below are ignored if Enabled = false. Enabled bool // FailureRatio is a percentage of all nodes that could fail simultinously. FailureRatio float64 // Interval is time between node failures. Interval time.Duration // JitterFactor is factor used to jitter node failures. // Node will be killed between [Interval, Interval + (1.0 + JitterFactor)]. JitterFactor float64 // SimulatedDowntime is a duration between node is killed and recreated. SimulatedDowntime time.Duration // NodeKillerStopCh is a channel that is used to notify NodeKiller to stop killing nodes. NodeKillerStopCh chan struct{} }
NodeKillerConfig describes configuration of NodeKiller -- a utility to simulate node failures.
type NodeSelection ¶ added in v1.15.0
NodeSelection specifies where to run a pod, using a combination of fixed node name, node selector and/or affinity.
type NodeTestContextType ¶ added in v1.4.0
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 kubeletconfig.KubeletConfiguration // 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 ¶ added in v1.13.0
type NullProvider struct{}
NullProvider is the default implementation of the ProviderInterface which doesn't do anything.
func (NullProvider) CleanupServiceResources ¶ added in v1.13.0
func (n NullProvider) CleanupServiceResources(c clientset.Interface, loadBalancerName, region, zone string)
CleanupServiceResources is a base implementation which cleans up service resources.
func (NullProvider) CreatePD ¶ added in v1.13.0
func (n NullProvider) CreatePD(zone string) (string, error)
CreatePD is a base implementation which creates PD.
func (NullProvider) CreatePVSource ¶ added in v1.13.0
func (n NullProvider) CreatePVSource(zone, diskName string) (*v1.PersistentVolumeSource, error)
CreatePVSource is a base implementation which creates PV source.
func (NullProvider) DeleteNode ¶ added in v1.14.0
func (n NullProvider) DeleteNode(node *v1.Node) error
DeleteNode is a base implementation which deletes a node.
func (NullProvider) DeletePD ¶ added in v1.13.0
func (n NullProvider) DeletePD(pdName string) error
DeletePD is a base implementation which deletes PD.
func (NullProvider) DeletePVSource ¶ added in v1.13.0
func (n NullProvider) DeletePVSource(pvSource *v1.PersistentVolumeSource) error
DeletePVSource is a base implementation which deletes PV source.
func (NullProvider) EnableAndDisableInternalLB ¶ added in v1.13.0
func (n NullProvider) EnableAndDisableInternalLB() (enable, disable func(svc *v1.Service))
EnableAndDisableInternalLB is a base implementation which returns functions for enabling/disabling an internal LB.
func (NullProvider) EnsureLoadBalancerResourcesDeleted ¶ added in v1.13.0
func (n NullProvider) EnsureLoadBalancerResourcesDeleted(ip, portRange string) error
EnsureLoadBalancerResourcesDeleted is a base implementation which ensures load balancer is deleted.
func (NullProvider) FrameworkAfterEach ¶ added in v1.13.0
func (n NullProvider) FrameworkAfterEach(f *Framework)
FrameworkAfterEach is a base implementation which does AfterEach.
func (NullProvider) FrameworkBeforeEach ¶ added in v1.13.0
func (n NullProvider) FrameworkBeforeEach(f *Framework)
FrameworkBeforeEach is a base implementation which does BeforeEach.
func (NullProvider) GetGroupNodes ¶ added in v1.13.0
func (n NullProvider) GetGroupNodes(group string) ([]string, error)
GetGroupNodes is a base implementation which returns group nodes.
func (NullProvider) GroupSize ¶ added in v1.13.0
func (n NullProvider) GroupSize(group string) (int, error)
GroupSize returns the size of an instance group
func (NullProvider) LoadBalancerSrcRanges ¶ added in v1.13.0
func (n NullProvider) LoadBalancerSrcRanges() []string
LoadBalancerSrcRanges is a base implementation which returns the ranges of ips used by load balancers.
func (NullProvider) ResizeGroup ¶ added in v1.13.0
func (n NullProvider) ResizeGroup(string, int32) error
ResizeGroup is a base implementation which resizes group.
type Options ¶ added in v1.15.0
type Options struct { ClientQPS float32 ClientBurst int GroupVersion *schema.GroupVersion }
Options is a struct for managing test framework options.
type PVCMap ¶ added in v1.6.0
type PVCMap map[types.NamespacedName]pvcval
PVCMap is a map of all PVCs used in the multi pv-pvc tests. The key is "namespace/pvc.Name". The value is {} (empty struct) since we're only interested in the PVC's name and if it is present. We must always Get the pvc object before referencing any of its values, eg. its VolumeName. Note: It's unsafe to add keys to a map in a loop. Their insertion in the map is
unpredictable and can result in the same key being iterated over again.
type PVMap ¶ added in v1.6.0
type PVMap map[string]pvval
PVMap is a map of all PVs used in the multi pv-pvc tests. The key is the PV's name, which is guaranteed to be unique. The value is {} (empty struct) since we're only interested in the PV's name and if it is present. We must always Get the pv object before referencing any of its values, eg its ClaimRef.
type PersistentVolumeClaimConfig ¶ added in v1.7.0
type PersistentVolumeClaimConfig struct { // NamePrefix defaults to "pvc-" if unspecified NamePrefix string // ClaimSize must be specified in the Quantity format. Defaults to 2Gi if // unspecified ClaimSize string // AccessModes defaults to RWO if unspecified AccessModes []v1.PersistentVolumeAccessMode Annotations map[string]string Selector *metav1.LabelSelector StorageClassName *string // VolumeMode defaults to nil if unspecified or specified as the empty // string VolumeMode *v1.PersistentVolumeMode }
PersistentVolumeClaimConfig is consumed by MakePersistentVolumeClaim() to generate a PVC object.
type PersistentVolumeConfig ¶ added in v1.6.0
type PersistentVolumeConfig struct { // [Optional] NamePrefix defaults to "pv-" if unset NamePrefix string // [Optional] Labels contains information used to organize and categorize // objects Labels labels.Set // PVSource contains the details of the underlying volume and must be set PVSource v1.PersistentVolumeSource // [Optional] Prebind lets you specify a PVC to bind this PV to before // creation Prebind *v1.PersistentVolumeClaim // [Optiona] ReclaimPolicy defaults to "Reclaim" if unset ReclaimPolicy v1.PersistentVolumeReclaimPolicy StorageClassName string // [Optional] NodeAffinity defines constraints that limit what nodes this // volume can be accessed from. NodeAffinity *v1.VolumeNodeAffinity // [Optional] VolumeMode defaults to "Filesystem" if unset VolumeMode *v1.PersistentVolumeMode // [Optional] AccessModes defaults to RWO if unset AccessModes []v1.PersistentVolumeAccessMode // [Optional] Capacity is the storage capacity in Quantity format. Defaults // to "2Gi" if unset Capacity string }
PersistentVolumeConfig is consumed by MakePersistentVolume() to generate a PV object for varying storage options (NFS, ceph, glusterFS, etc.). (+optional) prebind holds a pre-bound PVC Example pvSource:
pvSource: api.PersistentVolumeSource{ NFS: &api.NFSVolumeSource{ ... }, }
type PingCommand ¶ added in v1.9.0
type PingCommand string
PingCommand is the type to hold ping command.
const ( // IPv4PingCommand is a ping command for IPv4. IPv4PingCommand PingCommand = "ping" // IPv6PingCommand is a ping command for IPv6. IPv6PingCommand PingCommand = "ping6" )
type PodClient ¶ added in v1.4.0
type PodClient struct { v1core.PodInterface // contains filtered or unexported fields }
PodClient is a struct for pod client.
func (*PodClient) Create ¶ added in v1.4.0
Create creates a new pod according to the framework specifications (don't wait for it to start).
func (*PodClient) CreateBatch ¶ added in v1.4.0
CreateBatch create a batch of pods. All pods are created before waiting.
func (*PodClient) CreateEventually ¶ added in v1.13.0
CreateEventually retries pod creation for a while before failing the test with the most recent error. This mimicks the behavior of a controller (like the one for DaemonSet) and is necessary because pod creation can fail while its service account is still getting provisioned (https://github.com/kubernetes/kubernetes/issues/68776).
Both the timeout and polling interval are configurable as optional arguments: - The first optional argument is the timeout. - The second optional argument is the polling interval.
Both intervals can either be specified as time.Duration, parsable duration strings or as floats/integers. In the last case they are interpreted as seconds.
func (*PodClient) CreateSync ¶ added in v1.4.0
CreateSync creates a new pod according to the framework specifications, and wait for it to start.
func (*PodClient) CreateSyncInNamespace ¶ added in v1.6.0
CreateSyncInNamespace creates a new pod according to the framework specifications in the given namespace, and waits for it to start.
func (*PodClient) DeleteSync ¶ added in v1.5.0
DeleteSync deletes the pod and wait for the pod to disappear for `timeout`. If the pod doesn't disappear before the timeout, it will fail the test.
func (*PodClient) DeleteSyncInNamespace ¶ added in v1.6.0
func (c *PodClient) DeleteSyncInNamespace(name string, namespace string, options *metav1.DeleteOptions, timeout time.Duration)
DeleteSyncInNamespace deletes the pod from the namespace and wait for the pod to disappear for `timeout`. If the pod doesn't disappear before the timeout, it will fail the test.
func (*PodClient) MatchContainerOutput ¶ added in v1.5.0
func (c *PodClient) MatchContainerOutput(name string, containerName string, expectedRegexp string) error
MatchContainerOutput gets output of a container and match expected regexp in the output.
func (*PodClient) PodIsReady ¶ added in v1.12.0
PodIsReady returns true if the specified pod is ready. Otherwise false.
func (*PodClient) Update ¶ added in v1.4.0
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.
func (*PodClient) WaitForErrorEventOrSuccess ¶ added in v1.6.0
WaitForErrorEventOrSuccess waits for pod to succeed or an error event for that pod.
func (*PodClient) WaitForFailure ¶ added in v1.8.0
WaitForFailure waits for pod to fail.
func (*PodClient) WaitForFinish ¶ added in v1.15.0
WaitForFinish waits for pod to finish running, regardless of success or failure.
type PodStateVerification ¶
type PodStateVerification struct { // Optional: only pods that have k=v labels will pass this filter. Selectors map[string]string // Required: The phases which are valid for your pod. ValidPhases []v1.PodPhase // Optional: only pods passing this function will pass the filter // Verify a pod. // As an optimization, in addition to specifying filter (boolean), // this function allows specifying an error as well. // The error indicates that the polling of the pod spectrum should stop. Verify func(v1.Pod) (bool, error) // Optional: only pods with this name will pass the filter. PodName string }
PodStateVerification represents a verification of pod state. Any time you have a set of pods that you want to operate against or query, this struct can be used to declaratively identify those pods.
type ProviderInterface ¶ added in v1.13.0
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) DeleteNode(node *v1.Node) 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 ¶ added in v1.13.0
func SetupProviderConfig(providerName string) (ProviderInterface, error)
SetupProviderConfig validates the chosen provider and creates an interface instance for it.
type ResourceConstraint ¶
ResourceConstraint is a struct to hold constraints.
type ResourceGathererOptions ¶
type ResourceGathererOptions struct { InKubemark bool Nodes NodesSet ResourceDataGatheringPeriod time.Duration ProbeDuration time.Duration PrintVerboseLogs bool }
ResourceGathererOptions is a struct to hold options for resource.
type ResourceUsageSummary ¶
type ResourceUsageSummary map[string][]SingleContainerSummary
ResourceUsageSummary is a struct to hold resource usage summary. we can't have int here, as JSON does not accept integer keys.
func (*ResourceUsageSummary) PrintHumanReadable ¶
func (s *ResourceUsageSummary) PrintHumanReadable() string
PrintHumanReadable prints resource usage summary in human readable.
func (*ResourceUsageSummary) PrintJSON ¶
func (s *ResourceUsageSummary) PrintJSON() string
PrintJSON prints resource usage summary in JSON.
func (*ResourceUsageSummary) SummaryKind ¶ added in v1.7.0
func (s *ResourceUsageSummary) SummaryKind() string
SummaryKind returns string of ResourceUsageSummary
type SingleContainerSummary ¶
SingleContainerSummary is a struct to hold single container summary.
type SingleLogSummary ¶
SingleLogSummary is a structure for handling average generation rate and number of probes.
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 // ListImages will list off all images that are used then quit ListImages bool // 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 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 // DumpSystemdJournal controls whether to dump the full systemd journal. DumpSystemdJournal bool 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 MaxNodesToGather int 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 // The configuration of NodeKiller. NodeKiller NodeKillerConfig // The Default IP Family of the cluster ("ipv4" or "ipv6") IPFamily 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 should be used by all tests to access common context data.
type TestDataSummary ¶
type TestDataSummary interface { SummaryKind() string PrintHumanReadable() string PrintJSON() string }
TestDataSummary is an interface for managing test data.
type TimestampedSize ¶
type TimestampedSize struct {
// contains filtered or unexported fields
}
TimestampedSize contains a size together with a time of measurement.
type UDPPokeParams ¶ added in v1.13.6
UDPPokeParams is a struct for UDP poke parameters.
type UDPPokeResult ¶ added in v1.13.6
type UDPPokeResult struct { Status UDPPokeStatus Error error // if there was any error Response []byte // if code != 0 }
UDPPokeResult is a struct for UDP poke result.
func PokeUDP ¶ added in v1.13.6
func PokeUDP(host string, port int, request string, params *UDPPokeParams) UDPPokeResult
PokeUDP tries to connect to a host on a port and send the given request. Callers can specify additional success parameters, if desired.
The result status will be characterized as precisely as possible, given the known users of this.
The result error will be populated for any status other than Success.
The result response will be populated if the UDP transaction was completed, even if the other test params make this a failure).
type UDPPokeStatus ¶ added in v1.13.6
type UDPPokeStatus string
UDPPokeStatus is string for representing UDP poke status.
const ( // UDPSuccess is UDP poke status which is success. UDPSuccess UDPPokeStatus = "Success" // UDPError is UDP poke status which is error. UDPError UDPPokeStatus = "UnknownError" // UDPTimeout is UDP poke status which is timeout. UDPTimeout UDPPokeStatus = "TimedOut" // UDPRefused is UDP poke status which is connection refused. UDPRefused UDPPokeStatus = "ConnectionRefused" // UDPBadResponse is UDP poke status which is bad response. UDPBadResponse UDPPokeStatus = "BadResponse" )
type What ¶ added in v1.13.0
type What struct {
Kind string `json:"kind"`
}
What is a subset of metav1.TypeMeta which (in contrast to metav1.TypeMeta itself) satisfies the runtime.Object interface.
func (*What) DeepCopy ¶ added in v1.13.0
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new What.
func (*What) DeepCopyInto ¶ added in v1.13.0
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out.
func (*What) DeepCopyObject ¶ added in v1.13.0
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*What) GetObjectKind ¶ added in v1.13.0
func (in *What) GetObjectKind() schema.ObjectKind
GetObjectKind returns the ObjectKind schema
Source Files ¶
- cleanup.go
- create.go
- exec_util.go
- flake_reporting_util.go
- framework.go
- get-kubemark-resource-usage.go
- google_compute.go
- log_size_monitoring.go
- networking_utils.go
- nodes_util.go
- pods.go
- profile_gatherer.go
- provider.go
- pv_util.go
- rc_util.go
- resource_usage_gatherer.go
- size.go
- suites.go
- test_context.go
- util.go
Directories ¶
Path | Synopsis |
---|---|
Package config simplifies the declaration of configuration options.
|
Package config simplifies the declaration of configuration options. |
Package ginkgowrapper wraps Ginkgo Fail and Skip functions to panic with structured data instead of a constant string.
|
Package ginkgowrapper wraps Ginkgo Fail and Skip functions to panic with structured data instead of a constant string. |
Package podlogs enables live capturing of all events and log messages for some or all pods in a namespace as they get generated.
|
Package podlogs enables live capturing of all events and log messages for some or all pods in a namespace as they get generated. |
providers
|
|
Package testfiles provides a wrapper around various optional ways of retrieving additional files needed during a test run: - builtin bindata - filesystem access Because it is a is self-contained package, it can be used by test/e2e/framework and test/e2e/manifest without creating a circular dependency.
|
Package testfiles provides a wrapper around various optional ways of retrieving additional files needed during a test run: - builtin bindata - filesystem access Because it is a is self-contained package, it can be used by test/e2e/framework and test/e2e/manifest without creating a circular dependency. |