@@ -35,6 +35,7 @@ import (
3535 "volcano.sh/volcano/pkg/scheduler/api"
3636 "volcano.sh/volcano/pkg/scheduler/conf"
3737 "volcano.sh/volcano/pkg/scheduler/framework"
38+ "volcano.sh/volcano/pkg/scheduler/plugins/capacity"
3839 "volcano.sh/volcano/pkg/scheduler/plugins/conformance"
3940 "volcano.sh/volcano/pkg/scheduler/plugins/gang"
4041 "volcano.sh/volcano/pkg/scheduler/plugins/predicates"
@@ -425,6 +426,7 @@ func TestPreempt(t *testing.T) {
425426
426427func TestTopologyAwarePreempt (t * testing.T ) {
427428 plugins := map [string ]framework.PluginBuilder {
429+ capacity .PluginName : capacity .New ,
428430 conformance .PluginName : conformance .New ,
429431 gang .PluginName : gang .New ,
430432 priority .PluginName : priority .New ,
@@ -663,6 +665,28 @@ func TestTopologyAwarePreempt(t *testing.T) {
663665 ExpectEvictNum : 1 ,
664666 ExpectEvicted : []string {"c1/preemptee2" },
665667 },
668+ {
669+ Name : "preemption with priority queues" ,
670+ PodGroups : []* schedulingv1beta1.PodGroup {
671+ util .BuildPodGroupWithPrio ("pg3" , "c1" , "q2" , 1 , nil , schedulingv1beta1 .PodGroupRunning , "high-priority" ),
672+ util .BuildPodGroupWithPrio ("pg1" , "c1" , "q1" , 0 , nil , schedulingv1beta1 .PodGroupRunning , "low-priority" ),
673+ util .BuildPodGroupWithPrio ("pg2" , "c1" , "q1" , 1 , nil , schedulingv1beta1 .PodGroupInqueue , "high-priority" ),
674+ },
675+ Pods : []* v1.Pod {
676+ util .BuildPod ("c1" , "preemptee2" , "n1" , v1 .PodRunning , api .BuildResourceList ("1" , "1G" ), "pg3" , map [string ]string {schedulingv1beta1 .PodPreemptable : "true" }, make (map [string ]string )),
677+ util .BuildPod ("c1" , "preemptee1" , "n1" , v1 .PodRunning , api .BuildResourceList ("1" , "1G" ), "pg1" , map [string ]string {schedulingv1beta1 .PodPreemptable : "true" }, make (map [string ]string )),
678+ util .BuildPodWithPreemptionPolicy ("c1" , "preemptor1" , "" , v1 .PodPending , api .BuildResourceList ("1" , "1G" ), "pg2" , make (map [string ]string ), make (map [string ]string ), v1 .PreemptLowerPriority ),
679+ },
680+ Nodes : []* v1.Node {
681+ util .BuildNode ("n1" , api .BuildResourceList ("2" , "2Gi" , []api.ScalarResource {{Name : "pods" , Value : "2" }}... ), make (map [string ]string )),
682+ },
683+ Queues : []* schedulingv1beta1.Queue {
684+ util .BuildQueueWithPriorityAndResourcesQuantity ("q1" , 1 , api .BuildResourceList ("1" , "1G" ), api .BuildResourceList ("1" , "1G" )),
685+ util .BuildQueueWithPriorityAndResourcesQuantity ("q2" , 10 , api .BuildResourceList ("1" , "1G" ), api .BuildResourceList ("1" , "1G" )),
686+ },
687+ ExpectEvictNum : 1 ,
688+ ExpectEvicted : []string {"c1/preemptee1" },
689+ },
666690 }
667691
668692 trueValue := true
@@ -699,6 +723,10 @@ func TestTopologyAwarePreempt(t *testing.T) {
699723 EnabledPreemptable : & trueValue ,
700724 EnabledPredicate : & trueValue ,
701725 },
726+ {
727+ Name : capacity .PluginName ,
728+ EnabledQueueOrder : & trueValue ,
729+ },
702730 },
703731 }}
704732
0 commit comments