@@ -946,6 +946,19 @@ func TestSelectNodesForPreemption(t *testing.T) {
946
946
{ObjectMeta : metav1.ObjectMeta {Name : "e" , UID : types .UID ("e" )}, Spec : v1.PodSpec {Containers : largeContainers , Priority : & highPriority , NodeName : "machine2" }}},
947
947
expected : map [string ]map [string ]bool {"machine1" : {"b" : true , "c" : true }},
948
948
},
949
+ {
950
+ name : "mixed priority pods are preempted, pick later StartTime one when priorities are equal" ,
951
+ predicates : map [string ]algorithmpredicates.FitPredicate {"matches" : algorithmpredicates .PodFitsResources },
952
+ nodes : []string {"machine1" , "machine2" },
953
+ pod : & v1.Pod {ObjectMeta : metav1.ObjectMeta {Name : "machine1" , UID : types .UID ("machine1" )}, Spec : v1.PodSpec {Containers : largeContainers , Priority : & highPriority }},
954
+ pods : []* v1.Pod {
955
+ {ObjectMeta : metav1.ObjectMeta {Name : "a" , UID : types .UID ("a" )}, Spec : v1.PodSpec {Containers : smallContainers , Priority : & lowPriority , NodeName : "machine1" }, Status : v1.PodStatus {StartTime : & startTime20190107 }},
956
+ {ObjectMeta : metav1.ObjectMeta {Name : "b" , UID : types .UID ("b" )}, Spec : v1.PodSpec {Containers : smallContainers , Priority : & lowPriority , NodeName : "machine1" }, Status : v1.PodStatus {StartTime : & startTime20190106 }},
957
+ {ObjectMeta : metav1.ObjectMeta {Name : "c" , UID : types .UID ("c" )}, Spec : v1.PodSpec {Containers : mediumContainers , Priority : & midPriority , NodeName : "machine1" }, Status : v1.PodStatus {StartTime : & startTime20190105 }},
958
+ {ObjectMeta : metav1.ObjectMeta {Name : "d" , UID : types .UID ("d" )}, Spec : v1.PodSpec {Containers : smallContainers , Priority : & highPriority , NodeName : "machine1" }, Status : v1.PodStatus {StartTime : & startTime20190104 }},
959
+ {ObjectMeta : metav1.ObjectMeta {Name : "e" , UID : types .UID ("e" )}, Spec : v1.PodSpec {Containers : largeContainers , Priority : & highPriority , NodeName : "machine2" }, Status : v1.PodStatus {StartTime : & startTime20190103 }}},
960
+ expected : map [string ]map [string ]bool {"machine1" : {"a" : true , "c" : true }},
961
+ },
949
962
{
950
963
name : "pod with anti-affinity is preempted" ,
951
964
predicates : map [string ]algorithmpredicates.FitPredicate {"matches" : algorithmpredicates .PodFitsResources },
0 commit comments