@@ -338,6 +338,32 @@ func TestDefaultPodTopologySpreadScore(t *testing.T) {
338
338
expectedList : []framework.NodeScore {{Name : "machine1" , Score : 0 }, {Name : "machine2" , Score : 50 }},
339
339
name : "Another stateful set with partial pod label matches" ,
340
340
},
341
+ {
342
+ pod : & v1.Pod {
343
+ ObjectMeta : metav1.ObjectMeta {
344
+ Labels : labels1 ,
345
+ OwnerReferences : controllerRef ("StatefulSet" , "name" , "abc123" ),
346
+ },
347
+ Spec : v1.PodSpec {
348
+ TopologySpreadConstraints : []v1.TopologySpreadConstraint {
349
+ {
350
+ MaxSkew : 1 ,
351
+ TopologyKey : "foo" ,
352
+ WhenUnsatisfiable : v1 .DoNotSchedule ,
353
+ },
354
+ },
355
+ },
356
+ },
357
+ pods : []* v1.Pod {
358
+ {Spec : zone1Spec , ObjectMeta : metav1.ObjectMeta {Labels : labels2 , OwnerReferences : controllerRef ("StatefulSet" , "name" , "abc123" )}},
359
+ {Spec : zone1Spec , ObjectMeta : metav1.ObjectMeta {Labels : labels1 , OwnerReferences : controllerRef ("StatefulSet" , "name" , "abc123" )}},
360
+ {Spec : zone2Spec , ObjectMeta : metav1.ObjectMeta {Labels : labels1 , OwnerReferences : controllerRef ("StatefulSet" , "name" , "abc123" )}},
361
+ },
362
+ nodes : []string {"machine1" , "machine2" },
363
+ sss : []* apps.StatefulSet {{Spec : apps.StatefulSetSpec {Selector : & metav1.LabelSelector {MatchLabels : map [string ]string {"baz" : "blah" }}}}},
364
+ expectedList : []framework.NodeScore {{Name : "machine1" , Score : 0 }, {Name : "machine2" , Score : 0 }},
365
+ name : "Another stateful set with TopologySpreadConstraints set in pod" ,
366
+ },
341
367
}
342
368
343
369
for _ , test := range tests {
0 commit comments