Change:
obj.SetResourceVersion(strconv.FormatInt(intValue+1, 10)) } } func TestParallelScale(t *testing.T) { for _, tc := range []struct { <del> desc            string replicas        int32 desiredReplicas int32 </del> <ins> desc                        string replicas                    int32 desiredReplicas             int32 expectedMinParallelRequests int </ins> }{ { <del> desc:            "scale up from 3 to 30", replicas:        3, desiredReplicas: 30, </del> <ins> desc:                        "scale up from 3 to 30", replicas:                    3, desiredReplicas:             30, expectedMinParallelRequests: 2, </ins> }, { <del> desc:            "scale down from 10 to 1", replicas:        10, desiredReplicas: 1, </del> <ins> desc:                        "scale down from 10 to 1", replicas:                    10, desiredReplicas:             1, expectedMinParallelRequests: 2, </ins> }, { <del> desc:            "scale down to 0", replicas:        501, desiredReplicas: 0, </del> <ins> desc:                        "scale down to 0", replicas:                    501, desiredReplicas:             0, expectedMinParallelRequests: 10, </ins> }, { <del> desc:            "scale up from 0", replicas:        0, desiredReplicas: 1000, </del> <ins> desc:                        "scale up from 0", replicas:                    0, desiredReplicas:             1000, expectedMinParallelRequests: 20, </ins> }, } { t.Run(tc.desc, func(t *testing.T) { set := burst(newStatefulSet(0)) set.Spec.VolumeClaimTemplates[0].ObjectMeta.Labels = map[string]string{"test": "test"} <del> parallelScale(t, set, tc.replicas, tc.desiredReplicas, assertBurstInvariants) </del> <ins> parallelScale(t, set, tc.replicas, tc.desiredReplicas, tc.expectedMinParallelRequests, assertBurstInvariants) </ins> }) } } <del> func parallelScale(t *testing.T, set *apps.StatefulSet, replicas, desiredReplicas int32, invariants invariantFunc) { </del> <ins> func parallelScale(t *testing.T, set *apps.StatefulSet, replicas, desiredReplicas int32, expectedMinParallelRequests int, invariants invariantFunc) { </ins> var err error diff := desiredReplicas - replicas <ins> // maxParallelRequests: MaxBatchSize of the controller is 500, We divide the diff by 4 to allow maximum of the half of the last batch. if maxParallelRequests := min(500, math.Abs(float64(diff))/4); expectedMinParallelRequests < 2 || float64(expectedMinParallelRequests) > maxParallelRequests { t.Fatalf("expectedMinParallelRequests should be between 2 and %v. Batch size of the controller is expontially increasing until 500. "+ "Got expectedMinParallelRequests %v, ", maxParallelRequests, expectedMinParallelRequests) } </ins> client := fake.NewSimpleClientset(set) om, _, ssc := setupController(client) <del> om.createPodTracker.delay = time.Millisecond </del> <ins> om.createPodTracker.shouldTrackParallelRequests = true om.createPodTracker.parallelRequestDelay = time.Millisecond </ins> *set.Spec.Replicas = replicas if err := parallelScaleUpStatefulSetControl(set, ssc, om, invariants); err != nil {

Discussion:
https://prow.ppc64le- TestStatefulSetControl/CreatePodFailure/Burst/ScaleDownOnly/StatefulSetAutoDeletePVCEnabled of Have started observing more flakes recently since last week. No response_ Able to reproduce using stress tool. /sig testing /sig apps
/triage accepted /assign
opened a PR with a fix: