Change:
/assign flakes in PR jobs more than once per day The can filter down to searching for results for a single test:
This test continues to flake PRs at least once per day:
https://k8s-
looking at it

Discussion:
if !isCreated(replicas[i]) { return ssc.podControl.CreateStatefulPod(set, replicas[i]) } <ins> // If we find a Pod that is currently terminating, we must wait until graceful deletion // completes before we continue to make  progress. if isTerminating(replicas[i]) { glog.V(2).Infof("StatefulSet %s is waiting for Pod %s to Terminate", set.Name, replicas[i].Name) return nil } </ins> // If we have a Pod that has been created but is not running and ready we can not make progress. // We must ensure that all for each Pod, when we create it, all of its predecessors, with respect to its // ordinal, are Running and Ready.

} } <ins> func TestDefaultStatefulSetControlBlocksOnTerminating(t *testing.T) { set := newStatefulSet(3) client := fake.NewSimpleClientset(set) informerFactory := informers.NewSharedInformerFactory(client, controller.NoResyncPeriodFunc()) spc := newFakeStatefulPodControl(informerFactory.Core().V1().Pods(), informerFactory.Apps().V1beta1().StatefulSets()) ssc := NewDefaultStatefulSetControl(spc) spc.SetUpdateStatefulPodError(apierrors.NewInternalError(errors.New("API server failed")), 0) stop := make(chan struct{}) defer close(stop) informerFactory.Start(stop) cache.WaitForCacheSync( stop, informerFactory.Apps().V1beta1().StatefulSets().Informer().HasSynced, informerFactory.Core().V1().Pods().Informer().HasSynced, ) if err := scaleUpStatefulSetControl(set, ssc, spc); err != nil { t.Fatalf("Unexpected error: %v", err) } var err error set, err = spc.setsLister.StatefulSets(set.Namespace).Get(set.Name) if err != nil { t.Fatalf("Error getting updated StatefulSet: %v", err) } if set.Status.Replicas != 3 { t.Fatal("Failed to scale StatefulSet to 3 replicas") } // scale the set and add a terminated pod *set.Spec.Replicas = 4 pods, err := spc.addTerminatingPod(set, 2) if err != nil { t.Fatal(err) } if err := ssc.UpdateStatefulSet(set, pods); err != nil { t.Fatal(err) } pods, err = spc.podsLister.List(labels.Everything()) if err != nil { t.Fatalf("Error listing pods: %v", err) } if len(pods) != 3 { t.Fatalf("Expected 3 pods, got %d", len(pods)) } sort.Sort(ascendingOrdinal(pods)) spc.DeleteStatefulPod(set, pods[2]) pods, err = spc.podsLister.List(labels.Everything()) if err != nil { t.Fatalf("Error listing pods: %v", err) } if len(pods) != 2 { t.Fatalf("Expected 3 pods, got %d", len(pods)) } if err := scaleUpStatefulSetControl(set, ssc, spc); err != nil { t.Fatalf("Unexpected error: %v", err) } set, err = spc.setsLister.StatefulSets(set.Namespace).Get(set.Name) if err != nil { t.Fatalf("Error getting updated StatefulSet: %v", err) } if set.Status.Replicas != 4 { t.Fatal("Failed to scale StatefulSet to 3 replicas") } } </ins> func TestDefaultStatefulSetControlUpdateSetStatusFailure(t *testing.T) { set := newStatefulSet(3) client := fake.NewSimpleClientset(set)

return spc.podsLister.Pods(set.Namespace).List(selector) } <del> func (spc *fakeStatefulPodControl) addTerminatedPod(set *apps.StatefulSet, ordinal int) ([]*v1.Pod, error) { </del> <ins> func (spc *fakeStatefulPodControl) addTerminatingPod(set *apps.StatefulSet, ordinal int) ([]*v1.Pod, error) { </ins> pod := newStatefulSetPod(set, ordinal) pod.Status.Phase = v1.PodRunning deleted := metav1.NewTime(time.Now())

if err != nil { return err } <del> if pods, err = spc.addTerminatedPod(set, ordinal); err != nil { </del> <ins> if pods, err = spc.addTerminatingPod(set, ordinal); err != nil { </ins> return err } if err = ssc.UpdateStatefulSet(set, pods); err != nil {

if set.Status.Replicas != 3 { t.Error("Falied to scale statefulset to 3 replicas") } <del> pods, err := spc.addTerminatedPod(set, 3) </del> <ins> pods, err := spc.addTerminatingPod(set, 3) </ins> if err != nil { t.Error(err) } <del> pods, err = spc.addTerminatedPod(set, 4) </del> <ins> pods, err = spc.addTerminatingPod(set, 4) </ins> if err != nil { t.Error(err) }

spc.setsIndexer.Add(set) ssc.enqueueStatefulSet(set) fakeWorker(ssc) <del> pods, err = spc.addTerminatedPod(set, ord) </del> <ins> pods, err = spc.addTerminatingPod(set, ord) </ins> pod = getPodAtOrdinal(pods, ord) ssc.updatePod(&prev, pod) fakeWorker(ssc)

for set.Status.Replicas > *set.Spec.Replicas { pods, err = spc.podsLister.Pods(set.Namespace).List(selector) ord := len(pods) <del> pods, err = spc.addTerminatedPod(set, ord) </del> <ins> pods, err = spc.addTerminatingPod(set, ord) </ins> pod = getPodAtOrdinal(pods, ord) ssc.updatePod(&prev, pod) fakeWorker(ssc)

return pod.Status.Phase == v1.PodFailed } <del> // isTerminated returns true if pod's deletion Timestamp has been set func isTerminated(pod *v1.Pod) bool { </del> <ins> // isTerminating returns true if pod's DeletionTimestamp has been set func isTerminating(pod *v1.Pod) bool { </ins> return pod.DeletionTimestamp != nil } // isHealthy returns true if pod is running and ready and has not been terminated func isHealthy(pod *v1.Pod) bool { <del> return isRunningAndReady(pod) && !isTerminated(pod) </del> <ins> return isRunningAndReady(pod) && !isTerminating(pod) </ins> } // newControllerRef returns an ControllerRef pointing to a given StatefulSet.