Skip to content

Commit 17bae91

Browse files
authored
Merge pull request kubernetes#127088 from sanposhiho/fix-test
fix: run a test for requeueing with PreFilterResult correctly
2 parents 1c15f71 + 24a14aa commit 17bae91

File tree

11 files changed

+189
-64
lines changed

11 files changed

+189
-64
lines changed

pkg/scheduler/backend/queue/scheduling_queue.go

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
"time"
3636

3737
v1 "k8s.io/api/core/v1"
38+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3839
"k8s.io/apimachinery/pkg/types"
3940
"k8s.io/apimachinery/pkg/util/sets"
4041
"k8s.io/apimachinery/pkg/util/wait"
@@ -117,14 +118,18 @@ type SchedulingQueue interface {
117118
MoveAllToActiveOrBackoffQueue(logger klog.Logger, event framework.ClusterEvent, oldObj, newObj interface{}, preCheck PreEnqueueCheck)
118119
AssignedPodAdded(logger klog.Logger, pod *v1.Pod)
119120
AssignedPodUpdated(logger klog.Logger, oldPod, newPod *v1.Pod, event framework.ClusterEvent)
120-
PendingPods() ([]*v1.Pod, string)
121-
PodsInActiveQ() []*v1.Pod
122-
InFlightPods() []*v1.Pod
121+
123122
// Close closes the SchedulingQueue so that the goroutine which is
124123
// waiting to pop items can exit gracefully.
125124
Close()
126125
// Run starts the goroutines managing the queue.
127126
Run(logger klog.Logger)
127+
128+
// The following functions are supposed to be used only for testing or debugging.
129+
GetPod(name, namespace string) (*framework.QueuedPodInfo, bool)
130+
PendingPods() ([]*v1.Pod, string)
131+
InFlightPods() []*v1.Pod
132+
PodsInActiveQ() []*v1.Pod
128133
}
129134

130135
// NewSchedulingQueue initializes a priority queue as a new scheduling queue.
@@ -1149,6 +1154,34 @@ func (p *PriorityQueue) PodsInActiveQ() []*v1.Pod {
11491154

11501155
var pendingPodsSummary = "activeQ:%v; backoffQ:%v; unschedulablePods:%v"
11511156

1157+
// GetPod searches for a pod in the activeQ, backoffQ, and unschedulablePods.
1158+
func (p *PriorityQueue) GetPod(name, namespace string) (pInfo *framework.QueuedPodInfo, ok bool) {
1159+
p.lock.RLock()
1160+
defer p.lock.RUnlock()
1161+
1162+
pInfoLookup := &framework.QueuedPodInfo{
1163+
PodInfo: &framework.PodInfo{
1164+
Pod: &v1.Pod{
1165+
ObjectMeta: metav1.ObjectMeta{
1166+
Name: name,
1167+
Namespace: namespace,
1168+
},
1169+
},
1170+
},
1171+
}
1172+
if pInfo, ok = p.podBackoffQ.Get(pInfoLookup); ok {
1173+
return pInfo, true
1174+
}
1175+
if pInfo = p.unschedulablePods.get(pInfoLookup.Pod); pInfo != nil {
1176+
return pInfo, true
1177+
}
1178+
1179+
p.activeQ.underRLock(func(unlockedActiveQ unlockedActiveQueueReader) {
1180+
pInfo, ok = unlockedActiveQ.Get(pInfoLookup)
1181+
})
1182+
return
1183+
}
1184+
11521185
// PendingPods returns all the pending pods in the queue; accompanied by a debugging string
11531186
// recording showing the number of pods in each queue respectively.
11541187
// This function is used for debugging purposes in the scheduler cache dumper and comparer.

pkg/scheduler/backend/queue/scheduling_queue_test.go

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3964,6 +3964,92 @@ func Test_queuedPodInfo_gatedSetUponCreationAndUnsetUponUpdate(t *testing.T) {
39643964
}
39653965
}
39663966

3967+
func TestPriorityQueue_GetPod(t *testing.T) {
3968+
activeQPod := &v1.Pod{
3969+
ObjectMeta: metav1.ObjectMeta{
3970+
Name: "pod1",
3971+
Namespace: "default",
3972+
},
3973+
}
3974+
backoffQPod := &v1.Pod{
3975+
ObjectMeta: metav1.ObjectMeta{
3976+
Name: "pod2",
3977+
Namespace: "default",
3978+
},
3979+
}
3980+
unschedPod := &v1.Pod{
3981+
ObjectMeta: metav1.ObjectMeta{
3982+
Name: "pod3",
3983+
Namespace: "default",
3984+
},
3985+
}
3986+
3987+
_, ctx := ktesting.NewTestContext(t)
3988+
q := NewTestQueue(ctx, newDefaultQueueSort())
3989+
q.activeQ.underLock(func(unlockedActiveQ unlockedActiveQueuer) {
3990+
unlockedActiveQ.AddOrUpdate(newQueuedPodInfoForLookup(activeQPod))
3991+
})
3992+
q.podBackoffQ.AddOrUpdate(newQueuedPodInfoForLookup(backoffQPod))
3993+
q.unschedulablePods.addOrUpdate(newQueuedPodInfoForLookup(unschedPod))
3994+
3995+
tests := []struct {
3996+
name string
3997+
podName string
3998+
namespace string
3999+
expectedPod *v1.Pod
4000+
expectedOK bool
4001+
}{
4002+
{
4003+
name: "pod is found in activeQ",
4004+
podName: "pod1",
4005+
namespace: "default",
4006+
expectedPod: activeQPod,
4007+
expectedOK: true,
4008+
},
4009+
{
4010+
name: "pod is found in backoffQ",
4011+
podName: "pod2",
4012+
namespace: "default",
4013+
expectedPod: backoffQPod,
4014+
expectedOK: true,
4015+
},
4016+
{
4017+
name: "pod is found in unschedulablePods",
4018+
podName: "pod3",
4019+
namespace: "default",
4020+
expectedPod: unschedPod,
4021+
expectedOK: true,
4022+
},
4023+
{
4024+
name: "pod is not found",
4025+
podName: "pod4",
4026+
namespace: "default",
4027+
expectedPod: nil,
4028+
expectedOK: false,
4029+
},
4030+
}
4031+
4032+
for _, tt := range tests {
4033+
t.Run(tt.name, func(t *testing.T) {
4034+
pInfo, ok := q.GetPod(tt.podName, tt.namespace)
4035+
if ok != tt.expectedOK {
4036+
t.Errorf("Expected ok=%v, but got ok=%v", tt.expectedOK, ok)
4037+
}
4038+
4039+
if tt.expectedPod == nil {
4040+
if pInfo == nil {
4041+
return
4042+
}
4043+
t.Fatalf("Expected pod is empty, but got pod=%v", pInfo.Pod)
4044+
}
4045+
4046+
if !cmp.Equal(pInfo.Pod, tt.expectedPod) {
4047+
t.Errorf("Expected pod=%v, but got pod=%v", tt.expectedPod, pInfo.Pod)
4048+
}
4049+
})
4050+
}
4051+
}
4052+
39674053
func attemptQueuedPodInfo(podInfo *framework.QueuedPodInfo) *framework.QueuedPodInfo {
39684054
podInfo.Attempts++
39694055
return podInfo

pkg/scheduler/eventhandlers_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func TestPreCheckForNode(t *testing.T) {
129129
st.MakePod().Name("p1").Req(cpu4).Obj(),
130130
st.MakePod().Name("p2").Req(cpu16).Obj(),
131131
st.MakePod().Name("p3").Req(cpu4).Req(cpu8).Obj(),
132-
st.MakePod().Name("p4").NodeAffinityIn("hostname", []string{"fake-node"}).Obj(),
132+
st.MakePod().Name("p4").NodeAffinityIn("hostname", []string{"fake-node"}, st.NodeSelectorTypeMatchExpressions).Obj(),
133133
st.MakePod().Name("p5").NodeAffinityNotIn("hostname", []string{"fake-node"}).Obj(),
134134
st.MakePod().Name("p6").Obj(),
135135
st.MakePod().Name("p7").Node("invalid-node").Obj(),
@@ -150,7 +150,7 @@ func TestPreCheckForNode(t *testing.T) {
150150
st.MakePod().Name("p1").Req(cpu4).Obj(),
151151
st.MakePod().Name("p2").Req(cpu16).Obj(),
152152
st.MakePod().Name("p3").Req(cpu4).Req(cpu8).Obj(),
153-
st.MakePod().Name("p4").NodeAffinityIn("hostname", []string{"fake-node"}).Obj(),
153+
st.MakePod().Name("p4").NodeAffinityIn("hostname", []string{"fake-node"}, st.NodeSelectorTypeMatchExpressions).Obj(),
154154
st.MakePod().Name("p5").NodeAffinityNotIn("hostname", []string{"fake-node"}).Obj(),
155155
st.MakePod().Name("p6").Obj(),
156156
st.MakePod().Name("p7").Node("invalid-node").Obj(),
@@ -188,10 +188,10 @@ func TestPreCheckForNode(t *testing.T) {
188188
},
189189
pods: []*v1.Pod{
190190
st.MakePod().Name("p1").Req(cpu4).NodeAffinityNotIn("hostname", []string{"fake-node"}).Obj(),
191-
st.MakePod().Name("p2").Req(cpu16).NodeAffinityIn("hostname", []string{"fake-node"}).Obj(),
192-
st.MakePod().Name("p3").Req(cpu8).NodeAffinityIn("hostname", []string{"fake-node"}).Obj(),
191+
st.MakePod().Name("p2").Req(cpu16).NodeAffinityIn("hostname", []string{"fake-node"}, st.NodeSelectorTypeMatchExpressions).Obj(),
192+
st.MakePod().Name("p3").Req(cpu8).NodeAffinityIn("hostname", []string{"fake-node"}, st.NodeSelectorTypeMatchExpressions).Obj(),
193193
st.MakePod().Name("p4").HostPort(8080).Node("invalid-node").Obj(),
194-
st.MakePod().Name("p5").Req(cpu4).NodeAffinityIn("hostname", []string{"fake-node"}).HostPort(80).Obj(),
194+
st.MakePod().Name("p5").Req(cpu4).NodeAffinityIn("hostname", []string{"fake-node"}, st.NodeSelectorTypeMatchExpressions).HostPort(80).Obj(),
195195
},
196196
want: []bool{false, false, true, false, false},
197197
},

pkg/scheduler/framework/plugins/dynamicresources/dynamicresources_test.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,11 +137,7 @@ var (
137137
}},
138138
},
139139
NodeSelector: func() *v1.NodeSelector {
140-
// Label selector...
141-
nodeSelector := st.MakeNodeSelector().In("metadata.name", []string{nodeName}).Obj()
142-
// ... but we need a field selector, so let's swap.
143-
nodeSelector.NodeSelectorTerms[0].MatchExpressions, nodeSelector.NodeSelectorTerms[0].MatchFields = nodeSelector.NodeSelectorTerms[0].MatchFields, nodeSelector.NodeSelectorTerms[0].MatchExpressions
144-
return nodeSelector
140+
return st.MakeNodeSelector().In("metadata.name", []string{nodeName}, st.NodeSelectorTypeMatchFields).Obj()
145141
}(),
146142
}
147143
deallocatingClaim = st.FromResourceClaim(pendingClaim).
@@ -160,10 +156,10 @@ var (
160156
Obj()
161157

162158
allocatedClaimWithWrongTopology = st.FromResourceClaim(allocatedClaim).
163-
Allocation(&resourceapi.AllocationResult{Controller: controller, NodeSelector: st.MakeNodeSelector().In("no-such-label", []string{"no-such-value"}).Obj()}).
159+
Allocation(&resourceapi.AllocationResult{Controller: controller, NodeSelector: st.MakeNodeSelector().In("no-such-label", []string{"no-such-value"}, st.NodeSelectorTypeMatchExpressions).Obj()}).
164160
Obj()
165161
allocatedClaimWithGoodTopology = st.FromResourceClaim(allocatedClaim).
166-
Allocation(&resourceapi.AllocationResult{Controller: controller, NodeSelector: st.MakeNodeSelector().In("kubernetes.io/hostname", []string{nodeName}).Obj()}).
162+
Allocation(&resourceapi.AllocationResult{Controller: controller, NodeSelector: st.MakeNodeSelector().In("kubernetes.io/hostname", []string{nodeName}, st.NodeSelectorTypeMatchExpressions).Obj()}).
167163
Obj()
168164
otherClaim = st.MakeResourceClaim(controller).
169165
Name("not-my-claim").

pkg/scheduler/framework/plugins/nodeaffinity/node_affinity_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1233,7 +1233,7 @@ func TestNodeAffinityPriority(t *testing.T) {
12331233
}
12341234

12351235
func Test_isSchedulableAfterNodeChange(t *testing.T) {
1236-
podWithNodeAffinity := st.MakePod().NodeAffinityIn("foo", []string{"bar"})
1236+
podWithNodeAffinity := st.MakePod().NodeAffinityIn("foo", []string{"bar"}, st.NodeSelectorTypeMatchExpressions)
12371237
testcases := map[string]struct {
12381238
args *config.NodeAffinityArgs
12391239
pod *v1.Pod

pkg/scheduler/framework/plugins/podtopologyspread/filtering_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ func TestPreFilterState(t *testing.T) {
806806
{
807807
name: "NodeAffinityPolicy honored with nodeAffinity",
808808
pod: st.MakePod().Name("p").Label("foo", "").
809-
NodeAffinityIn("foo", []string{""}).
809+
NodeAffinityIn("foo", []string{""}, st.NodeSelectorTypeMatchExpressions).
810810
SpreadConstraint(1, "node", v1.DoNotSchedule, barSelector, nil, nil, nil, nil).
811811
Obj(),
812812
nodes: []*v1.Node{
@@ -845,7 +845,7 @@ func TestPreFilterState(t *testing.T) {
845845
{
846846
name: "NodeAffinityPolicy ignored with nodeAffinity",
847847
pod: st.MakePod().Name("p").Label("foo", "").
848-
NodeAffinityIn("foo", []string{""}).
848+
NodeAffinityIn("foo", []string{""}, st.NodeSelectorTypeMatchExpressions).
849849
SpreadConstraint(1, "node", v1.DoNotSchedule, barSelector, nil, &ignorePolicy, nil, nil).
850850
Obj(),
851851
nodes: []*v1.Node{
@@ -2708,7 +2708,7 @@ func TestSingleConstraint(t *testing.T) {
27082708
// the fact that node-a fits can prove the underlying logic works
27092709
name: "incoming pod has nodeAffinity, pods spread as 2/~1~/~0~/3, hence node-a fits",
27102710
pod: st.MakePod().Name("p").Label("foo", "").
2711-
NodeAffinityIn("node", []string{"node-a", "node-y"}).
2711+
NodeAffinityIn("node", []string{"node-a", "node-y"}, st.NodeSelectorTypeMatchExpressions).
27122712
SpreadConstraint(1, "node", v1.DoNotSchedule, fooSelector, nil, nil, nil, nil).
27132713
Obj(),
27142714
nodes: []*v1.Node{
@@ -2951,7 +2951,7 @@ func TestSingleConstraint(t *testing.T) {
29512951
// pods spread across node as 1/1/0/~0~
29522952
name: "NodeAffinityPolicy honored with nodeAffinity",
29532953
pod: st.MakePod().Name("p").Label("foo", "").
2954-
NodeAffinityIn("foo", []string{""}).
2954+
NodeAffinityIn("foo", []string{""}, st.NodeSelectorTypeMatchExpressions).
29552955
SpreadConstraint(1, "node", v1.DoNotSchedule, fooSelector, nil, nil, nil, nil).
29562956
Obj(),
29572957
nodes: []*v1.Node{
@@ -2977,7 +2977,7 @@ func TestSingleConstraint(t *testing.T) {
29772977
// pods spread across node as 1/1/0/~1~
29782978
name: "NodeAffinityPolicy ignored with labelSelectors",
29792979
pod: st.MakePod().Name("p").Label("foo", "").
2980-
NodeAffinityIn("foo", []string{""}).
2980+
NodeAffinityIn("foo", []string{""}, st.NodeSelectorTypeMatchExpressions).
29812981
SpreadConstraint(1, "node", v1.DoNotSchedule, fooSelector, nil, &ignorePolicy, nil, nil).
29822982
Obj(),
29832983
nodes: []*v1.Node{

pkg/scheduler/framework/plugins/podtopologyspread/scoring_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
439439
{
440440
name: "NodeAffinityPolicy honored with nodeAffinity",
441441
pod: st.MakePod().Name("p").Label("foo", "").
442-
NodeAffinityIn("foo", []string{""}).
442+
NodeAffinityIn("foo", []string{""}, st.NodeSelectorTypeMatchExpressions).
443443
SpreadConstraint(1, "zone", v1.ScheduleAnyway, barSelector, nil, nil, nil, nil).
444444
Obj(),
445445
nodes: []*v1.Node{
@@ -473,7 +473,7 @@ func TestPreScoreStateEmptyNodes(t *testing.T) {
473473
{
474474
name: "NodeAffinityPolicy ignored with nodeAffinity",
475475
pod: st.MakePod().Name("p").Label("foo", "").
476-
NodeAffinityIn("foo", []string{""}).
476+
NodeAffinityIn("foo", []string{""}, st.NodeSelectorTypeMatchExpressions).
477477
SpreadConstraint(1, "zone", v1.ScheduleAnyway, barSelector, nil, &ignorePolicy, nil, nil).
478478
Obj(),
479479
nodes: []*v1.Node{
@@ -1164,7 +1164,7 @@ func TestPodTopologySpreadScore(t *testing.T) {
11641164
{
11651165
name: "NodeAffinityPolicy honoed with nodeAffinity",
11661166
pod: st.MakePod().Name("p").Label("foo", "").
1167-
NodeAffinityIn("foo", []string{""}).
1167+
NodeAffinityIn("foo", []string{""}, st.NodeSelectorTypeMatchExpressions).
11681168
SpreadConstraint(1, "node", v1.ScheduleAnyway, fooSelector, nil, nil, nil, nil).
11691169
Obj(),
11701170
nodes: []*v1.Node{
@@ -1188,7 +1188,7 @@ func TestPodTopologySpreadScore(t *testing.T) {
11881188
{
11891189
name: "NodeAffinityPolicy ignored with nodeAffinity",
11901190
pod: st.MakePod().Name("p").Label("foo", "").
1191-
NodeAffinityIn("foo", []string{""}).
1191+
NodeAffinityIn("foo", []string{""}, st.NodeSelectorTypeMatchExpressions).
11921192
SpreadConstraint(1, "node", v1.ScheduleAnyway, fooSelector, nil, &ignorePolicy, nil, nil).
11931193
Obj(),
11941194
nodes: []*v1.Node{

pkg/scheduler/testing/wrappers.go

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,28 @@ func MakeNodeSelector() *NodeSelectorWrapper {
4040
return &NodeSelectorWrapper{v1.NodeSelector{}}
4141
}
4242

43+
type NodeSelectorType int
44+
45+
const (
46+
NodeSelectorTypeMatchExpressions NodeSelectorType = iota
47+
NodeSelectorTypeMatchFields
48+
)
49+
4350
// In injects a matchExpression (with an operator IN) as a selectorTerm
4451
// to the inner nodeSelector.
4552
// NOTE: appended selecterTerms are ORed.
46-
func (s *NodeSelectorWrapper) In(key string, vals []string) *NodeSelectorWrapper {
53+
func (s *NodeSelectorWrapper) In(key string, vals []string, t NodeSelectorType) *NodeSelectorWrapper {
4754
expression := v1.NodeSelectorRequirement{
4855
Key: key,
4956
Operator: v1.NodeSelectorOpIn,
5057
Values: vals,
5158
}
5259
selectorTerm := v1.NodeSelectorTerm{}
53-
selectorTerm.MatchExpressions = append(selectorTerm.MatchExpressions, expression)
60+
if t == NodeSelectorTypeMatchExpressions {
61+
selectorTerm.MatchExpressions = append(selectorTerm.MatchExpressions, expression)
62+
} else {
63+
selectorTerm.MatchFields = append(selectorTerm.MatchFields, expression)
64+
}
5465
s.NodeSelectorTerms = append(s.NodeSelectorTerms, selectorTerm)
5566
return s
5667
}
@@ -320,19 +331,19 @@ func (p *PodWrapper) NodeSelector(m map[string]string) *PodWrapper {
320331

321332
// NodeAffinityIn creates a HARD node affinity (with the operator In)
322333
// and injects into the inner pod.
323-
func (p *PodWrapper) NodeAffinityIn(key string, vals []string) *PodWrapper {
334+
func (p *PodWrapper) NodeAffinityIn(key string, vals []string, t NodeSelectorType) *PodWrapper {
324335
if p.Spec.Affinity == nil {
325336
p.Spec.Affinity = &v1.Affinity{}
326337
}
327338
if p.Spec.Affinity.NodeAffinity == nil {
328339
p.Spec.Affinity.NodeAffinity = &v1.NodeAffinity{}
329340
}
330-
nodeSelector := MakeNodeSelector().In(key, vals).Obj()
341+
nodeSelector := MakeNodeSelector().In(key, vals, t).Obj()
331342
p.Spec.Affinity.NodeAffinity.RequiredDuringSchedulingIgnoredDuringExecution = nodeSelector
332343
return p
333344
}
334345

335-
// NodeAffinityNotIn creates a HARD node affinity (with the operator NotIn)
346+
// NodeAffinityNotIn creates a HARD node affinity (with MatchExpressinos and the operator NotIn)
336347
// and injects into the inner pod.
337348
func (p *PodWrapper) NodeAffinityNotIn(key string, vals []string) *PodWrapper {
338349
if p.Spec.Affinity == nil {
@@ -882,7 +893,7 @@ func (p *PersistentVolumeWrapper) HostPathVolumeSource(src *v1.HostPathVolumeSou
882893
return p
883894
}
884895

885-
// NodeAffinityIn creates a HARD node affinity (with the operator In)
896+
// NodeAffinityIn creates a HARD node affinity (with MatchExpressions and the operator In)
886897
// and injects into the pv.
887898
func (p *PersistentVolumeWrapper) NodeAffinityIn(key string, vals []string) *PersistentVolumeWrapper {
888899
if p.Spec.NodeAffinity == nil {
@@ -891,7 +902,7 @@ func (p *PersistentVolumeWrapper) NodeAffinityIn(key string, vals []string) *Per
891902
if p.Spec.NodeAffinity.Required == nil {
892903
p.Spec.NodeAffinity.Required = &v1.NodeSelector{}
893904
}
894-
nodeSelector := MakeNodeSelector().In(key, vals).Obj()
905+
nodeSelector := MakeNodeSelector().In(key, vals, NodeSelectorTypeMatchExpressions).Obj()
895906
p.Spec.NodeAffinity.Required.NodeSelectorTerms = append(p.Spec.NodeAffinity.Required.NodeSelectorTerms, nodeSelector.NodeSelectorTerms...)
896907
return p
897908
}

test/integration/scheduler/filters/filters_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,7 @@ func TestPodTopologySpreadFilter(t *testing.T) {
14001400
{
14011401
name: "pod is required to be placed on zone0, so only node-1 fits",
14021402
incomingPod: st.MakePod().Name("p").Label("foo", "").Container(pause).
1403-
NodeAffinityIn("zone", []string{"zone-0"}).
1403+
NodeAffinityIn("zone", []string{"zone-0"}, st.NodeSelectorTypeMatchExpressions).
14041404
SpreadConstraint(1, "node", hardSpread, st.MakeLabelSelector().Exists("foo").Obj(), nil, nil, nil, nil).
14051405
Obj(),
14061406
existingPods: []*v1.Pod{
@@ -1583,7 +1583,7 @@ func TestPodTopologySpreadFilter(t *testing.T) {
15831583
{
15841584
name: "NodeAffinityPolicy ignored with nodeAffinity, pods spread across zone as 1/~2~",
15851585
incomingPod: st.MakePod().Name("p").Label("foo", "").Container(pause).
1586-
NodeAffinityIn("foo", []string{""}).
1586+
NodeAffinityIn("foo", []string{""}, st.NodeSelectorTypeMatchExpressions).
15871587
SpreadConstraint(1, "zone", v1.DoNotSchedule, st.MakeLabelSelector().Exists("foo").Obj(), nil, &ignorePolicy, nil, nil).
15881588
Obj(),
15891589
existingPods: []*v1.Pod{

0 commit comments

Comments
 (0)