@@ -44,6 +44,7 @@ import (
44
44
"k8s.io/kubernetes/pkg/features"
45
45
"k8s.io/kubernetes/pkg/scheduler/framework"
46
46
plfeature "k8s.io/kubernetes/pkg/scheduler/framework/plugins/feature"
47
+ "k8s.io/kubernetes/pkg/scheduler/framework/plugins/names"
47
48
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/queuesort"
48
49
"k8s.io/kubernetes/pkg/scheduler/framework/plugins/schedulinggates"
49
50
"k8s.io/kubernetes/pkg/scheduler/metrics"
@@ -1499,13 +1500,21 @@ func TestPriorityQueue_MoveAllToActiveOrBackoffQueueWithQueueingHint(t *testing.
1499
1500
expectedQ : unschedulablePods ,
1500
1501
},
1501
1502
{
1502
- name : "QueueHintFunction is not called when Pod is gated" ,
1503
- podInfo : setQueuedPodInfoGated (& framework.QueuedPodInfo {PodInfo : mustNewPodInfo (p ), UnschedulablePlugins : sets .New ("foo" )}),
1503
+ name : "QueueHintFunction is not called when Pod is gated by SchedulingGates plugin " ,
1504
+ podInfo : setQueuedPodInfoGated (& framework.QueuedPodInfo {PodInfo : mustNewPodInfo (p ), UnschedulablePlugins : sets .New (names . SchedulingGates , "foo" )}),
1504
1505
hint : func (logger klog.Logger , pod * v1.Pod , oldObj , newObj interface {}) (framework.QueueingHint , error ) {
1505
1506
return framework .Queue , fmt .Errorf ("QueueingHintFn should not be called as pod is gated" )
1506
1507
},
1507
1508
expectedQ : unschedulablePods ,
1508
1509
},
1510
+ {
1511
+ name : "QueueHintFunction is called when Pod is gated by a plugin other than SchedulingGates" ,
1512
+ podInfo : setQueuedPodInfoGated (& framework.QueuedPodInfo {PodInfo : mustNewPodInfo (p ), UnschedulablePlugins : sets .New ("foo" )}),
1513
+ hint : queueHintReturnQueue ,
1514
+ // FIXME: This should be backoffQ.
1515
+ // https://github.com/kubernetes/kubernetes/issues/125538
1516
+ expectedQ : activeQ ,
1517
+ },
1509
1518
}
1510
1519
1511
1520
for _ , test := range tests {
@@ -1518,14 +1527,13 @@ func TestPriorityQueue_MoveAllToActiveOrBackoffQueueWithQueueingHint(t *testing.
1518
1527
QueueingHintFn : test .hint ,
1519
1528
},
1520
1529
}
1521
- test .podInfo .UnschedulablePlugins = sets .New ("foo" )
1522
1530
cl := testingclock .NewFakeClock (now )
1523
1531
q := NewTestQueue (ctx , newDefaultQueueSort (), WithQueueingHintMapPerProfile (m ), WithClock (cl ))
1524
- // add to unsched pod pool
1525
1532
q .activeQ .Add (q .newQueuedPodInfo (test .podInfo .Pod ))
1526
1533
if p , err := q .Pop (logger ); err != nil || p .Pod != test .podInfo .Pod {
1527
1534
t .Errorf ("Expected: %v after Pop, but got: %v" , test .podInfo .Pod .Name , p .Pod .Name )
1528
1535
}
1536
+ // add to unsched pod pool
1529
1537
err := q .AddUnschedulableIfNotPresent (logger , test .podInfo , q .SchedulingCycle ())
1530
1538
if err != nil {
1531
1539
t .Fatalf ("unexpected error from AddUnschedulableIfNotPresent: %v" , err )
0 commit comments