@@ -253,8 +253,8 @@ func WaitForPodTerminatedInNamespace(c clientset.Interface, podName, reason, nam
253
253
}
254
254
255
255
// waitForPodSuccessInNamespaceTimeout returns nil if the pod reached state success, or an error if it reached failure or ran too long.
256
- func waitForPodSuccessInNamespaceTimeout (c clientset.Interface , podName string , namespace string , timeout time.Duration ) error {
257
- return WaitForPodCondition (c , namespace , podName , "success or failure" , timeout , func (pod * v1.Pod ) (bool , error ) {
256
+ func waitForPodSuccessInNamespaceTimeout (c clientset.Interface , podName , namespace string , timeout time.Duration ) error {
257
+ return WaitForPodCondition (c , namespace , podName , fmt . Sprintf ( "%s or %s" , v1 . PodSucceeded , v1 . PodFailed ) , timeout , func (pod * v1.Pod ) (bool , error ) {
258
258
if pod .Spec .RestartPolicy == v1 .RestartPolicyAlways {
259
259
return true , fmt .Errorf ("pod %q will never terminate with a succeeded state since its restart policy is Always" , podName )
260
260
}
@@ -275,12 +275,12 @@ func waitForPodSuccessInNamespaceTimeout(c clientset.Interface, podName string,
275
275
// if the pod Get api returns an error (IsNotFound or other), or if the pod failed with an unexpected reason.
276
276
// Typically called to test that the passed-in pod is Pending and Unschedulable.
277
277
func WaitForPodNameUnschedulableInNamespace (c clientset.Interface , podName , namespace string ) error {
278
- return WaitForPodCondition (c , namespace , podName , "Unschedulable" , podStartTimeout , func (pod * v1.Pod ) (bool , error ) {
278
+ return WaitForPodCondition (c , namespace , podName , v1 . PodReasonUnschedulable , podStartTimeout , func (pod * v1.Pod ) (bool , error ) {
279
279
// Only consider Failed pods. Successful pods will be deleted and detected in
280
280
// waitForPodCondition's Get call returning `IsNotFound`
281
281
if pod .Status .Phase == v1 .PodPending {
282
282
for _ , cond := range pod .Status .Conditions {
283
- if cond .Type == v1 .PodScheduled && cond .Status == v1 .ConditionFalse && cond .Reason == "Unschedulable" {
283
+ if cond .Type == v1 .PodScheduled && cond .Status == v1 .ConditionFalse && cond .Reason == v1 . PodReasonUnschedulable {
284
284
return true , nil
285
285
}
286
286
}
0 commit comments