Merge pull request #125862 from sanposhiho/cleanup-nominated
cleanup: remove duplicated AddNominatedPod
This commit is contained in:
		@@ -810,7 +810,6 @@ func (p *PriorityQueue) addUnschedulableWithoutQueueingHint(logger klog.Logger,
 | 
				
			|||||||
		metrics.SchedulerQueueIncomingPods.WithLabelValues("unschedulable", ScheduleAttemptFailure).Inc()
 | 
							metrics.SchedulerQueueIncomingPods.WithLabelValues("unschedulable", ScheduleAttemptFailure).Inc()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p.AddNominatedPod(logger, pInfo.PodInfo, nil)
 | 
					 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -863,7 +862,6 @@ func (p *PriorityQueue) AddUnschedulableIfNotPresent(logger klog.Logger, pInfo *
 | 
				
			|||||||
		p.cond.Broadcast()
 | 
							p.cond.Broadcast()
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	p.AddNominatedPod(logger, pInfo.PodInfo, nil)
 | 
					 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -865,18 +865,6 @@ func TestPriorityQueue_AddUnschedulableIfNotPresent(t *testing.T) {
 | 
				
			|||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err)
 | 
							t.Fatalf("unexpected error from AddUnschedulableIfNotPresent: %v", err)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	expectedNominatedPods := &nominator{
 | 
					 | 
				
			||||||
		nominatedPodToNode: map[types.UID]string{
 | 
					 | 
				
			||||||
			unschedulablePodInfo.Pod.UID:    "node1",
 | 
					 | 
				
			||||||
			highPriNominatedPodInfo.Pod.UID: "node1",
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
		nominatedPods: map[string][]PodRef{
 | 
					 | 
				
			||||||
			"node1": {PodToRef(highPriNominatedPodInfo.Pod), PodToRef(unschedulablePodInfo.Pod)},
 | 
					 | 
				
			||||||
		},
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if diff := cmp.Diff(q.nominator, expectedNominatedPods, nominatorCmpOpts...); diff != "" {
 | 
					 | 
				
			||||||
		t.Errorf("Unexpected diff after adding pods (-want, +got):\n%s", diff)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if p, err := q.Pop(logger); err != nil || p.Pod != highPriNominatedPodInfo.Pod {
 | 
						if p, err := q.Pop(logger); err != nil || p.Pod != highPriNominatedPodInfo.Pod {
 | 
				
			||||||
		t.Errorf("Expected: %v after Pop, but got: %v", highPriNominatedPodInfo.Pod.Name, p.Pod.Name)
 | 
							t.Errorf("Expected: %v after Pop, but got: %v", highPriNominatedPodInfo.Pod.Name, p.Pod.Name)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user