Change:
/kind failing-test <!-- If this is a flake, please add: /kind flake --/kind flake <!-- Please assign a SIG using: /sig SIG-NAME --/sig scheduling
/cc Introduced at
/triage accepted
Thanks for reminder. I will fix this.
This flakes in and UT flakes should be fixed ASAP. /priority important-soon BTW, is this flake only a test flake or a possible bug? /cc Test Freeze in March 27th.
/assign Given the code freeze is just around the corner, reverting PR (for now) is also an option for us. Especially I believe it's not something we must include in the release.
flake again /reopen /cc
Reopened this issue. <detailsIn response to : flake again /reopen /cc </details
could you help revert (and possibly as well)?

Discussion:
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/util/sets" <ins> "k8s.io/apimachinery/pkg/util/wait" </ins> utilfeature "k8s.io/apiserver/pkg/util/feature" "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes"

fakeClient := fake.NewSimpleClientset(objs...) informerFactory := informers.NewSharedInformerFactory(fakeClient, 0) eventBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{Interface: fakeClient.EventsV1()}) <ins> defer eventBroadcaster.Shutdown() </ins> eventRecorder := eventBroadcaster.NewRecorder(scheme.Scheme, fakePermit) outOfTreeRegistry := frameworkruntime.Registry{

} _, ctx := ktesting.NewTestContext(t) <del> ctx, cancel := context.WithCancel(ctx) </del> <ins> // timeout equals to the permit plugin waiting time. ctx, cancel := context.WithTimeout(ctx, 100*time.Second) </ins> defer cancel() scheduler, err := New(

// Wait all pods in waitSchedulingPods to be scheduled. wg.Wait() <del> // Ensure that all waitingPods in scheduler can be obtained from any profiles. for _, fwk := range scheduler.Profiles { actualPodNamesInWaitingPods := sets.NewString() fwk.IterateOverWaitingPods(func(pod framework.WaitingPod) { actualPodNamesInWaitingPods.Insert(pod.GetPod().Name) }) // Validate the name of pods in waitingPods matches expectations. if actualPodNamesInWaitingPods.Len() != len(tc.expectPodNamesInWaitingPods) || !actualPodNamesInWaitingPods.HasAll(tc.expectPodNamesInWaitingPods...) { t.Fatalf("Unexpected waitingPods in scheduler profile %s, expect: %#v, got: %#v", fwk.ProfileName(), tc.expectPodNamesInWaitingPods, actualPodNamesInWaitingPods.List()) </del> <ins> // When permit plugin emits the event, pod may not been added to the waitingPods pool yet, so we use pollUntil here. if err := wait.PollUntilContextCancel(ctx, 100*time.Microsecond, true, func(context.Context) (done bool, err error) { // Ensure that all waitingPods in scheduler can be obtained from any profiles. for _, fwk := range scheduler.Profiles { actualPodNamesInWaitingPods := sets.NewString() fwk.IterateOverWaitingPods(func(pod framework.WaitingPod) { actualPodNamesInWaitingPods.Insert(pod.GetPod().Name) }) // Validate the name of pods in waitingPods matches expectations. if actualPodNamesInWaitingPods.Len() != len(tc.expectPodNamesInWaitingPods) || !actualPodNamesInWaitingPods.HasAll(tc.expectPodNamesInWaitingPods...) { return false, fmt.Errorf("Unexpected waitingPods in scheduler profile %s, expect: %#v, got: %#v", fwk.ProfileName(), tc.expectPodNamesInWaitingPods, actualPodNamesInWaitingPods.List()) } </ins> } <ins> return true, nil }); err != nil { t.Fatal("got unexpected result") </ins> } }) }