mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Cleanup SetPredicatesOrderingDuringTest due to deprecation of predicates
This commit is contained in:
parent
ce2102f363
commit
051be8fe80
@ -77,13 +77,3 @@ func portsConflict(existingPorts schedulernodeinfo.HostPortInfo, wantPorts []*v1
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetPredicatesOrderingDuringTest sets the predicatesOrdering to the specified
|
|
||||||
// value, and returns a function that restores the original value.
|
|
||||||
func SetPredicatesOrderingDuringTest(value []string) func() {
|
|
||||||
origVal := predicatesOrdering
|
|
||||||
predicatesOrdering = value
|
|
||||||
return func() {
|
|
||||||
predicatesOrdering = origVal
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -58,8 +58,6 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
errPrioritize = fmt.Errorf("priority map encounters an error")
|
errPrioritize = fmt.Errorf("priority map encounters an error")
|
||||||
// TODO(Huang-Wei): remove 'order' and 'defer SetPredicatesOrderingDuringTest(order)()'.
|
|
||||||
order = []string{"FakeFilter", "FalseFilter", "TrueFilter", "MatchFilter", "NoPodsFilter", interpodaffinity.Name}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type trueFilterPlugin struct{}
|
type trueFilterPlugin struct{}
|
||||||
@ -367,8 +365,6 @@ func TestSelectHost(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestGenericScheduler(t *testing.T) {
|
func TestGenericScheduler(t *testing.T) {
|
||||||
defer algorithmpredicates.SetPredicatesOrderingDuringTest(order)()
|
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
registerPlugins []st.RegisterPluginFunc
|
registerPlugins []st.RegisterPluginFunc
|
||||||
@ -839,7 +835,6 @@ func makeScheduler(nodes []*v1.Node, fns ...st.RegisterPluginFunc) *genericSched
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFindFitAllError(t *testing.T) {
|
func TestFindFitAllError(t *testing.T) {
|
||||||
defer algorithmpredicates.SetPredicatesOrderingDuringTest(order)()
|
|
||||||
nodes := makeNodeList([]string{"3", "2", "1"})
|
nodes := makeNodeList([]string{"3", "2", "1"})
|
||||||
scheduler := makeScheduler(
|
scheduler := makeScheduler(
|
||||||
nodes,
|
nodes,
|
||||||
@ -872,7 +867,6 @@ func TestFindFitAllError(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFindFitSomeError(t *testing.T) {
|
func TestFindFitSomeError(t *testing.T) {
|
||||||
defer algorithmpredicates.SetPredicatesOrderingDuringTest(order)()
|
|
||||||
nodes := makeNodeList([]string{"3", "2", "1"})
|
nodes := makeNodeList([]string{"3", "2", "1"})
|
||||||
scheduler := makeScheduler(
|
scheduler := makeScheduler(
|
||||||
nodes,
|
nodes,
|
||||||
@ -909,8 +903,6 @@ func TestFindFitSomeError(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFindFitPredicateCallCounts(t *testing.T) {
|
func TestFindFitPredicateCallCounts(t *testing.T) {
|
||||||
defer algorithmpredicates.SetPredicatesOrderingDuringTest(order)()
|
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
pod *v1.Pod
|
pod *v1.Pod
|
||||||
@ -1284,8 +1276,6 @@ var startTime20190107 = metav1.Date(2019, 1, 7, 1, 1, 1, 0, time.UTC)
|
|||||||
// TestSelectNodesForPreemption tests selectNodesForPreemption. This test assumes
|
// TestSelectNodesForPreemption tests selectNodesForPreemption. This test assumes
|
||||||
// that podsFitsOnNode works correctly and is tested separately.
|
// that podsFitsOnNode works correctly and is tested separately.
|
||||||
func TestSelectNodesForPreemption(t *testing.T) {
|
func TestSelectNodesForPreemption(t *testing.T) {
|
||||||
defer algorithmpredicates.SetPredicatesOrderingDuringTest(order)()
|
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
registerPlugins []st.RegisterPluginFunc
|
registerPlugins []st.RegisterPluginFunc
|
||||||
@ -1295,7 +1285,6 @@ func TestSelectNodesForPreemption(t *testing.T) {
|
|||||||
filterReturnCode framework.Code
|
filterReturnCode framework.Code
|
||||||
expected map[string]map[string]bool // Map from node name to a list of pods names which should be preempted.
|
expected map[string]map[string]bool // Map from node name to a list of pods names which should be preempted.
|
||||||
expectedNumFilterCalled int32
|
expectedNumFilterCalled int32
|
||||||
addAffinityPredicate bool
|
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "a pod that does not fit on any machine",
|
name: "a pod that does not fit on any machine",
|
||||||
@ -1441,7 +1430,6 @@ func TestSelectNodesForPreemption(t *testing.T) {
|
|||||||
{ObjectMeta: metav1.ObjectMeta{Name: "e", UID: types.UID("e")}, Spec: v1.PodSpec{Containers: largeContainers, Priority: &highPriority, NodeName: "machine2"}}},
|
{ObjectMeta: metav1.ObjectMeta{Name: "e", UID: types.UID("e")}, Spec: v1.PodSpec{Containers: largeContainers, Priority: &highPriority, NodeName: "machine2"}}},
|
||||||
expected: map[string]map[string]bool{"machine1": {"a": true}, "machine2": {}},
|
expected: map[string]map[string]bool{"machine1": {"a": true}, "machine2": {}},
|
||||||
expectedNumFilterCalled: 4,
|
expectedNumFilterCalled: 4,
|
||||||
addAffinityPredicate: true,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "preemption to resolve even pods spread FitError",
|
name: "preemption to resolve even pods spread FitError",
|
||||||
@ -1640,7 +1628,6 @@ func TestSelectNodesForPreemption(t *testing.T) {
|
|||||||
|
|
||||||
// TestPickOneNodeForPreemption tests pickOneNodeForPreemption.
|
// TestPickOneNodeForPreemption tests pickOneNodeForPreemption.
|
||||||
func TestPickOneNodeForPreemption(t *testing.T) {
|
func TestPickOneNodeForPreemption(t *testing.T) {
|
||||||
defer algorithmpredicates.SetPredicatesOrderingDuringTest(order)()
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
registerFilterPlugin st.RegisterPluginFunc
|
registerFilterPlugin st.RegisterPluginFunc
|
||||||
@ -1991,7 +1978,6 @@ func TestNodesWherePreemptionMightHelp(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPreempt(t *testing.T) {
|
func TestPreempt(t *testing.T) {
|
||||||
defer algorithmpredicates.SetPredicatesOrderingDuringTest(order)()
|
|
||||||
defaultFailedNodeToStatusMap := framework.NodeToStatusMap{
|
defaultFailedNodeToStatusMap := framework.NodeToStatusMap{
|
||||||
"machine1": framework.NewStatus(framework.Unschedulable, algorithmpredicates.NewInsufficientResourceError(v1.ResourceMemory, 1000, 500, 300).GetReason()),
|
"machine1": framework.NewStatus(framework.Unschedulable, algorithmpredicates.NewInsufficientResourceError(v1.ResourceMemory, 1000, 500, 300).GetReason()),
|
||||||
"machine2": framework.NewStatus(framework.Unschedulable, algorithmpredicates.ErrDiskConflict.GetReason()),
|
"machine2": framework.NewStatus(framework.Unschedulable, algorithmpredicates.ErrDiskConflict.GetReason()),
|
||||||
@ -2451,7 +2437,6 @@ func assignDefaultStartTime(pods []*v1.Pod) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFairEvaluationForNodes(t *testing.T) {
|
func TestFairEvaluationForNodes(t *testing.T) {
|
||||||
defer algorithmpredicates.SetPredicatesOrderingDuringTest(order)()
|
|
||||||
numAllNodes := 500
|
numAllNodes := 500
|
||||||
nodeNames := make([]string, 0, numAllNodes)
|
nodeNames := make([]string, 0, numAllNodes)
|
||||||
for i := 0; i < numAllNodes; i++ {
|
for i := 0; i < numAllNodes; i++ {
|
||||||
|
Loading…
Reference in New Issue
Block a user