This commit is contained in:
notpad
2020-02-11 16:51:21 +08:00
parent a7057f8df0
commit fb895056c6
11 changed files with 81 additions and 5 deletions

View File

@@ -599,3 +599,21 @@ func mustGetNodeInfo(t *testing.T, snapshot *cache.Snapshot, name string) *nodei
}
return nodeInfo
}
func TestPreFilterDisabled(t *testing.T) {
pod := &v1.Pod{}
nodeInfo := nodeinfo.NewNodeInfo()
node := v1.Node{}
nodeInfo.SetNode(&node)
p := &ServiceAffinity{
args: Args{
AffinityLabels: []string{"region"},
},
}
cycleState := framework.NewCycleState()
gotStatus := p.Filter(context.Background(), cycleState, pod, nodeInfo)
wantStatus := framework.NewStatus(framework.Error, `error reading "PreFilterServiceAffinity" from cycleState: not found`)
if !reflect.DeepEqual(gotStatus, wantStatus) {
t.Errorf("status does not match: %v, want: %v", gotStatus, wantStatus)
}
}