const defaultPodDeletionTimeout … const podListTimeout … const podRespondingTimeout … const podScheduledBeforeTimeout … const podStartTimeout … const singleCallTimeout … const slowPodStartTimeout … type podCondition … // BeRunningNoRetries verifies that a pod starts running. It's a permanent // failure when the pod enters some other permanent phase. func BeRunningNoRetries() types.GomegaMatcher { … } // BeInPhase matches if pod.status.phase is the expected phase. func BeInPhase(phase v1.PodPhase) types.GomegaMatcher { … } // WaitForAlmostAllReady waits up to timeout for the following conditions: // 1. At least minPods Pods in Namespace ns are Running and Ready // 2. All Pods in Namespace ns are either Ready or Succeeded // 3. All Pods part of a ReplicaSet or ReplicationController in Namespace ns are Ready // // After the timeout has elapsed, an error is returned if the number of Pods in a Pending Phase // is greater than allowedNotReadyPods. // // It is generally recommended to use WaitForPodsRunningReady instead of this function // whenever possible, because its behavior is more intuitive. Similar to WaitForPodsRunningReady, // this function requests the list of pods on every iteration, making it useful for situations // where the set of Pods is likely changing, such as during cluster startup. // // If minPods or allowedNotReadyPods are -1, this method returns immediately // without waiting. func WaitForAlmostAllPodsReady(ctx context.Context, c clientset.Interface, ns string, minPods, allowedNotReadyPods int, timeout time.Duration) error { … } // WaitForPodsRunningReady waits up to timeout for the following conditions: // 1. At least minPods Pods in Namespace ns are Running and Ready // 2. No Pods in Namespace ns are Failed and not owned by a controller or Pending // // An error is returned if either of these conditions are not met within the timeout. // // It has separate behavior from other 'wait for' pods functions in // that it requests the list of pods on every iteration. This is useful, for // example, in cluster startup, because the number of pods increases while // waiting. All pods that are in SUCCESS state are not counted. func WaitForPodsRunningReady(ctx context.Context, c clientset.Interface, ns string, minPods int, timeout time.Duration) error { … } // WaitForPodCondition waits a pods to be matched to the given condition. // The condition callback may use gomega.StopTrying to abort early. func WaitForPodCondition(ctx context.Context, c clientset.Interface, ns, podName, conditionDesc string, timeout time.Duration, condition podCondition) error { … } type Range … // Min returns how many items must exist. func (r Range) Min() int { … } // WaitForPods waits for pods in the given namespace to match the given // condition. How many pods must exist and how many must match the condition // is determined by the range parameter. The condition callback may use // gomega.StopTrying(...).Now() to abort early. The condition description // will be used with "expected pods to <description>". func WaitForPods(ctx context.Context, c clientset.Interface, ns string, opts metav1.ListOptions, r Range, timeout time.Duration, conditionDesc string, condition func(*v1.Pod) bool) (*v1.PodList, error) { … } // RunningReady checks whether pod p's phase is running and it has a ready // condition of status true. func RunningReady(p *v1.Pod) bool { … } // WaitForPodsRunning waits for a given `timeout` to evaluate if a certain amount of pods in given `ns` are running. func WaitForPodsRunning(ctx context.Context, c clientset.Interface, ns string, num int, timeout time.Duration) error { … } // WaitForPodsSchedulingGated waits for a given `timeout` to evaluate if a certain amount of pods in given `ns` stay in scheduling gated state. func WaitForPodsSchedulingGated(ctx context.Context, c clientset.Interface, ns string, num int, timeout time.Duration) error { … } // WaitForPodsWithSchedulingGates waits for a given `timeout` to evaluate if a certain amount of pods in given `ns` // match the given `schedulingGates`stay in scheduling gated state. func WaitForPodsWithSchedulingGates(ctx context.Context, c clientset.Interface, ns string, num int, timeout time.Duration, schedulingGates []v1.PodSchedulingGate) error { … } // WaitForPodTerminatedInNamespace returns an error if it takes too long for the pod to terminate, // if the pod Get api returns an error (IsNotFound or other), or if the pod failed (and thus did not // terminate) with an unexpected reason. Typically called to test that the passed-in pod is fully // terminated (reason==""), but may be called to detect if a pod did *not* terminate according to // the supplied reason. func WaitForPodTerminatedInNamespace(ctx context.Context, c clientset.Interface, podName, reason, namespace string) error { … } // WaitForPodTerminatingInNamespaceTimeout returns if the pod is terminating, or an error if it is not after the timeout. func WaitForPodTerminatingInNamespaceTimeout(ctx context.Context, c clientset.Interface, podName, namespace string, timeout time.Duration) error { … } // WaitForPodSuccessInNamespaceTimeout returns nil if the pod reached state success, or an error if it reached failure or ran too long. func WaitForPodSuccessInNamespaceTimeout(ctx context.Context, c clientset.Interface, podName, namespace string, timeout time.Duration) error { … } // WaitForPodNameUnschedulableInNamespace returns an error if it takes too long for the pod to become Pending // and have condition Status equal to Unschedulable, // if the pod Get api returns an error (IsNotFound or other), or if the pod failed with an unexpected reason. // Typically called to test that the passed-in pod is Pending and Unschedulable. func WaitForPodNameUnschedulableInNamespace(ctx context.Context, c clientset.Interface, podName, namespace string) error { … } // WaitForPodNameRunningInNamespace waits default amount of time (PodStartTimeout) for the specified pod to become running. // Returns an error if timeout occurs first, or pod goes in to failed state. func WaitForPodNameRunningInNamespace(ctx context.Context, c clientset.Interface, podName, namespace string) error { … } // WaitForPodRunningInNamespaceSlow waits an extended amount of time (slowPodStartTimeout) for the specified pod to become running. // The resourceVersion is used when Watching object changes, it tells since when we care // about changes to the pod. Returns an error if timeout occurs first, or pod goes in to failed state. func WaitForPodRunningInNamespaceSlow(ctx context.Context, c clientset.Interface, podName, namespace string) error { … } // WaitTimeoutForPodRunningInNamespace waits the given timeout duration for the specified pod to become running. // It does not need to exist yet when this function gets called and the pod is not expected to be recreated // when it succeeds or fails. func WaitTimeoutForPodRunningInNamespace(ctx context.Context, c clientset.Interface, podName, namespace string, timeout time.Duration) error { … } // WaitForPodRunningInNamespace waits default amount of time (podStartTimeout) for the specified pod to become running. // Returns an error if timeout occurs first, or pod goes in to failed state. func WaitForPodRunningInNamespace(ctx context.Context, c clientset.Interface, pod *v1.Pod) error { … } // WaitTimeoutForPodNoLongerRunningInNamespace waits the given timeout duration for the specified pod to stop. func WaitTimeoutForPodNoLongerRunningInNamespace(ctx context.Context, c clientset.Interface, podName, namespace string, timeout time.Duration) error { … } // WaitForPodNoLongerRunningInNamespace waits default amount of time (defaultPodDeletionTimeout) for the specified pod to stop running. // Returns an error if timeout occurs first. func WaitForPodNoLongerRunningInNamespace(ctx context.Context, c clientset.Interface, podName, namespace string) error { … } // WaitTimeoutForPodReadyInNamespace waits the given timeout duration for the // specified pod to be ready and running. func WaitTimeoutForPodReadyInNamespace(ctx context.Context, c clientset.Interface, podName, namespace string, timeout time.Duration) error { … } // WaitForPodNotPending returns an error if it took too long for the pod to go out of pending state. // The resourceVersion is used when Watching object changes, it tells since when we care // about changes to the pod. func WaitForPodNotPending(ctx context.Context, c clientset.Interface, ns, podName string) error { … } // WaitForPodSuccessInNamespace returns nil if the pod reached state success, or an error if it reached failure or until podStartupTimeout. func WaitForPodSuccessInNamespace(ctx context.Context, c clientset.Interface, podName string, namespace string) error { … } // WaitForPodNotFoundInNamespace returns an error if it takes too long for the pod to fully terminate. // Unlike `waitForPodTerminatedInNamespace`, the pod's Phase and Reason are ignored. If the pod Get // api returns IsNotFound then the wait stops and nil is returned. If the Get api returns an error other // than "not found" and that error is final, that error is returned and the wait stops. func WaitForPodNotFoundInNamespace(ctx context.Context, c clientset.Interface, podName, ns string, timeout time.Duration) error { … } // WaitForPodsResponding waits for the pods to response. func WaitForPodsResponding(ctx context.Context, c clientset.Interface, ns string, controllerName string, wantName bool, timeout time.Duration, pods *v1.PodList) error { … } func isElementOf(podUID apitypes.UID, pods *v1.PodList) bool { … } // WaitForNumberOfPods waits up to timeout to ensure there are exact // `num` pods in namespace `ns`. // It returns the matching Pods or a timeout error. func WaitForNumberOfPods(ctx context.Context, c clientset.Interface, ns string, num int, timeout time.Duration) (pods *v1.PodList, err error) { … } // WaitForPodsWithLabelScheduled waits for all matching pods to become scheduled and at least one // matching pod exists. Return the list of matching pods. func WaitForPodsWithLabelScheduled(ctx context.Context, c clientset.Interface, ns string, label labels.Selector) (pods *v1.PodList, err error) { … } // WaitForPodsWithLabel waits up to podListTimeout for getting pods with certain label func WaitForPodsWithLabel(ctx context.Context, c clientset.Interface, ns string, label labels.Selector) (*v1.PodList, error) { … } // WaitForPodsWithLabelRunningReady waits for exact amount of matching pods to become running and ready. // Return the list of matching pods. func WaitForPodsWithLabelRunningReady(ctx context.Context, c clientset.Interface, ns string, label labels.Selector, num int, timeout time.Duration) (pods *v1.PodList, err error) { … } // WaitForNRestartablePods tries to list restarting pods using ps until it finds expect of them, // returning their names if it can do so before timeout. func WaitForNRestartablePods(ctx context.Context, ps *testutils.PodStore, expect int, timeout time.Duration) ([]string, error) { … } // WaitForPodContainerToFail waits for the given Pod container to fail with the given reason, specifically due to // invalid container configuration. In this case, the container will remain in a waiting state with a specific // reason set, which should match the given reason. func WaitForPodContainerToFail(ctx context.Context, c clientset.Interface, namespace, podName string, containerIndex int, reason string, timeout time.Duration) error { … } // WaitForPodScheduled waits for the pod to be schedule, ie. the .spec.nodeName is set func WaitForPodScheduled(ctx context.Context, c clientset.Interface, namespace, podName string) error { … } // WaitForPodContainerStarted waits for the given Pod container to start, after a successful run of the startupProbe. func WaitForPodContainerStarted(ctx context.Context, c clientset.Interface, namespace, podName string, containerIndex int, timeout time.Duration) error { … } // WaitForPodFailedReason wait for pod failed reason in status, for example "SysctlForbidden". func WaitForPodFailedReason(ctx context.Context, c clientset.Interface, pod *v1.Pod, reason string, timeout time.Duration) error { … } // WaitForContainerRunning waits for the given Pod container to have a state of running func WaitForContainerRunning(ctx context.Context, c clientset.Interface, namespace, podName, containerName string, timeout time.Duration) error { … } // WaitForContainerTerminated waits for the given Pod container to have a state of terminated func WaitForContainerTerminated(ctx context.Context, c clientset.Interface, namespace, podName, containerName string, timeout time.Duration) error { … }