mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 10:51:29 +00:00
Merge pull request #112702 from enj/enj/i/revert_scheduler_parallel
Revert "Enable paralellism in scheduler unit tests"
This commit is contained in:
commit
748daeb862
@ -48,7 +48,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestNodeAllocatableChanged(t *testing.T) {
|
func TestNodeAllocatableChanged(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
newQuantity := func(value int64) resource.Quantity {
|
newQuantity := func(value int64) resource.Quantity {
|
||||||
return *resource.NewQuantity(value, resource.BinarySI)
|
return *resource.NewQuantity(value, resource.BinarySI)
|
||||||
}
|
}
|
||||||
@ -71,9 +70,7 @@ func TestNodeAllocatableChanged(t *testing.T) {
|
|||||||
NewAllocatable: v1.ResourceList{v1.ResourceMemory: newQuantity(1024), v1.ResourceStorage: newQuantity(1024)},
|
NewAllocatable: v1.ResourceList{v1.ResourceMemory: newQuantity(1024), v1.ResourceStorage: newQuantity(1024)},
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
test := test
|
|
||||||
t.Run(test.Name, func(t *testing.T) {
|
t.Run(test.Name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
oldNode := &v1.Node{Status: v1.NodeStatus{Allocatable: test.OldAllocatable}}
|
oldNode := &v1.Node{Status: v1.NodeStatus{Allocatable: test.OldAllocatable}}
|
||||||
newNode := &v1.Node{Status: v1.NodeStatus{Allocatable: test.NewAllocatable}}
|
newNode := &v1.Node{Status: v1.NodeStatus{Allocatable: test.NewAllocatable}}
|
||||||
changed := nodeAllocatableChanged(newNode, oldNode)
|
changed := nodeAllocatableChanged(newNode, oldNode)
|
||||||
@ -85,7 +82,6 @@ func TestNodeAllocatableChanged(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNodeLabelsChanged(t *testing.T) {
|
func TestNodeLabelsChanged(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
Name string
|
Name string
|
||||||
Changed bool
|
Changed bool
|
||||||
@ -106,9 +102,7 @@ func TestNodeLabelsChanged(t *testing.T) {
|
|||||||
NewLabels: map[string]string{"foo": "bar", "test": "value"},
|
NewLabels: map[string]string{"foo": "bar", "test": "value"},
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
test := test
|
|
||||||
t.Run(test.Name, func(t *testing.T) {
|
t.Run(test.Name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
oldNode := &v1.Node{ObjectMeta: metav1.ObjectMeta{Labels: test.OldLabels}}
|
oldNode := &v1.Node{ObjectMeta: metav1.ObjectMeta{Labels: test.OldLabels}}
|
||||||
newNode := &v1.Node{ObjectMeta: metav1.ObjectMeta{Labels: test.NewLabels}}
|
newNode := &v1.Node{ObjectMeta: metav1.ObjectMeta{Labels: test.NewLabels}}
|
||||||
changed := nodeLabelsChanged(newNode, oldNode)
|
changed := nodeLabelsChanged(newNode, oldNode)
|
||||||
@ -120,7 +114,6 @@ func TestNodeLabelsChanged(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNodeTaintsChanged(t *testing.T) {
|
func TestNodeTaintsChanged(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
for _, test := range []struct {
|
for _, test := range []struct {
|
||||||
Name string
|
Name string
|
||||||
Changed bool
|
Changed bool
|
||||||
@ -140,9 +133,7 @@ func TestNodeTaintsChanged(t *testing.T) {
|
|||||||
NewTaints: []v1.Taint{{Key: "key", Value: "value2"}},
|
NewTaints: []v1.Taint{{Key: "key", Value: "value2"}},
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
test := test
|
|
||||||
t.Run(test.Name, func(t *testing.T) {
|
t.Run(test.Name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
oldNode := &v1.Node{Spec: v1.NodeSpec{Taints: test.OldTaints}}
|
oldNode := &v1.Node{Spec: v1.NodeSpec{Taints: test.OldTaints}}
|
||||||
newNode := &v1.Node{Spec: v1.NodeSpec{Taints: test.NewTaints}}
|
newNode := &v1.Node{Spec: v1.NodeSpec{Taints: test.NewTaints}}
|
||||||
changed := nodeTaintsChanged(newNode, oldNode)
|
changed := nodeTaintsChanged(newNode, oldNode)
|
||||||
@ -154,7 +145,6 @@ func TestNodeTaintsChanged(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNodeConditionsChanged(t *testing.T) {
|
func TestNodeConditionsChanged(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
nodeConditionType := reflect.TypeOf(v1.NodeCondition{})
|
nodeConditionType := reflect.TypeOf(v1.NodeCondition{})
|
||||||
if nodeConditionType.NumField() != 6 {
|
if nodeConditionType.NumField() != 6 {
|
||||||
t.Errorf("NodeCondition type has changed. The nodeConditionsChanged() function must be reevaluated.")
|
t.Errorf("NodeCondition type has changed. The nodeConditionsChanged() function must be reevaluated.")
|
||||||
@ -197,9 +187,7 @@ func TestNodeConditionsChanged(t *testing.T) {
|
|||||||
NewConditions: []v1.NodeCondition{{Type: v1.NodeReady, Status: v1.ConditionTrue}},
|
NewConditions: []v1.NodeCondition{{Type: v1.NodeReady, Status: v1.ConditionTrue}},
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
test := test
|
|
||||||
t.Run(test.Name, func(t *testing.T) {
|
t.Run(test.Name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
oldNode := &v1.Node{Status: v1.NodeStatus{Conditions: test.OldConditions}}
|
oldNode := &v1.Node{Status: v1.NodeStatus{Conditions: test.OldConditions}}
|
||||||
newNode := &v1.Node{Status: v1.NodeStatus{Conditions: test.NewConditions}}
|
newNode := &v1.Node{Status: v1.NodeStatus{Conditions: test.NewConditions}}
|
||||||
changed := nodeConditionsChanged(newNode, oldNode)
|
changed := nodeConditionsChanged(newNode, oldNode)
|
||||||
@ -211,7 +199,6 @@ func TestNodeConditionsChanged(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUpdatePodInCache(t *testing.T) {
|
func TestUpdatePodInCache(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
ttl := 10 * time.Second
|
ttl := 10 * time.Second
|
||||||
nodeName := "node"
|
nodeName := "node"
|
||||||
|
|
||||||
@ -232,9 +219,7 @@ func TestUpdatePodInCache(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
sched := &Scheduler{
|
sched := &Scheduler{
|
||||||
@ -266,7 +251,6 @@ func withPodName(pod *v1.Pod, name string) *v1.Pod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPreCheckForNode(t *testing.T) {
|
func TestPreCheckForNode(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
cpu4 := map[v1.ResourceName]string{v1.ResourceCPU: "4"}
|
cpu4 := map[v1.ResourceName]string{v1.ResourceCPU: "4"}
|
||||||
cpu8 := map[v1.ResourceName]string{v1.ResourceCPU: "8"}
|
cpu8 := map[v1.ResourceName]string{v1.ResourceCPU: "8"}
|
||||||
cpu16 := map[v1.ResourceName]string{v1.ResourceCPU: "16"}
|
cpu16 := map[v1.ResourceName]string{v1.ResourceCPU: "16"}
|
||||||
@ -353,9 +337,7 @@ func TestPreCheckForNode(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
nodeInfo := framework.NewNodeInfo(tt.existingPods...)
|
nodeInfo := framework.NewNodeInfo(tt.existingPods...)
|
||||||
nodeInfo.SetNode(tt.nodeFn())
|
nodeInfo.SetNode(tt.nodeFn())
|
||||||
preCheckFn := preCheckForNode(nodeInfo)
|
preCheckFn := preCheckForNode(nodeInfo)
|
||||||
@ -374,7 +356,6 @@ func TestPreCheckForNode(t *testing.T) {
|
|||||||
|
|
||||||
// test for informers of resources we care about is registered
|
// test for informers of resources we care about is registered
|
||||||
func TestAddAllEventHandlers(t *testing.T) {
|
func TestAddAllEventHandlers(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
gvkMap map[framework.GVK]framework.ActionType
|
gvkMap map[framework.GVK]framework.ActionType
|
||||||
@ -448,9 +429,7 @@ func TestAddAllEventHandlers(t *testing.T) {
|
|||||||
localSchemeBuilder.AddToScheme(scheme)
|
localSchemeBuilder.AddToScheme(scheme)
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
@ -482,7 +461,6 @@ func TestAddAllEventHandlers(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAdmissionCheck(t *testing.T) {
|
func TestAdmissionCheck(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
nodeaffinityError := AdmissionResult{Name: nodeaffinity.Name, Reason: nodeaffinity.ErrReasonPod}
|
nodeaffinityError := AdmissionResult{Name: nodeaffinity.Name, Reason: nodeaffinity.ErrReasonPod}
|
||||||
nodenameError := AdmissionResult{Name: nodename.Name, Reason: nodename.ErrReason}
|
nodenameError := AdmissionResult{Name: nodename.Name, Reason: nodename.ErrReason}
|
||||||
nodeportsError := AdmissionResult{Name: nodeports.Name, Reason: nodeports.ErrReason}
|
nodeportsError := AdmissionResult{Name: nodeports.Name, Reason: nodeports.ErrReason}
|
||||||
@ -524,9 +502,7 @@ func TestAdmissionCheck(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
nodeInfo := framework.NewNodeInfo(tt.existingPods...)
|
nodeInfo := framework.NewNodeInfo(tt.existingPods...)
|
||||||
nodeInfo.SetNode(tt.node)
|
nodeInfo.SetNode(tt.node)
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestSchedulerWithExtenders(t *testing.T) {
|
func TestSchedulerWithExtenders(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
registerPlugins []st.RegisterPluginFunc
|
registerPlugins []st.RegisterPluginFunc
|
||||||
@ -331,7 +330,6 @@ func createNode(name string) *v1.Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIsInterested(t *testing.T) {
|
func TestIsInterested(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
mem := &HTTPExtender{
|
mem := &HTTPExtender{
|
||||||
managedResources: sets.NewString(),
|
managedResources: sets.NewString(),
|
||||||
}
|
}
|
||||||
@ -374,9 +372,7 @@ func TestIsInterested(t *testing.T) {
|
|||||||
want: true,
|
want: true,
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
tc := tc
|
|
||||||
t.Run(tc.label, func(t *testing.T) {
|
t.Run(tc.label, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
if got := tc.extender.IsInterested(tc.pod); got != tc.want {
|
if got := tc.extender.IsInterested(tc.pod); got != tc.want {
|
||||||
t.Fatalf("IsInterested(%v) = %v, wanted %v", tc.pod, got, tc.want)
|
t.Fatalf("IsInterested(%v) = %v, wanted %v", tc.pod, got, tc.want)
|
||||||
}
|
}
|
||||||
@ -385,7 +381,6 @@ func TestIsInterested(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestConvertToMetaVictims(t *testing.T) {
|
func TestConvertToMetaVictims(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
nodeNameToVictims map[string]*extenderv1.Victims
|
nodeNameToVictims map[string]*extenderv1.Victims
|
||||||
@ -428,9 +423,7 @@ func TestConvertToMetaVictims(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
if got := convertToMetaVictims(tt.nodeNameToVictims); !reflect.DeepEqual(got, tt.want) {
|
if got := convertToMetaVictims(tt.nodeNameToVictims); !reflect.DeepEqual(got, tt.want) {
|
||||||
t.Errorf("convertToMetaVictims() = %v, want %v", got, tt.want)
|
t.Errorf("convertToMetaVictims() = %v, want %v", got, tt.want)
|
||||||
}
|
}
|
||||||
@ -439,7 +432,6 @@ func TestConvertToMetaVictims(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestConvertToVictims(t *testing.T) {
|
func TestConvertToVictims(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
httpExtender *HTTPExtender
|
httpExtender *HTTPExtender
|
||||||
@ -496,9 +488,7 @@ func TestConvertToVictims(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
// nodeInfos instantiations
|
// nodeInfos instantiations
|
||||||
nodeInfoList := make([]*framework.NodeInfo, 0, len(tt.nodeNames))
|
nodeInfoList := make([]*framework.NodeInfo, 0, len(tt.nodeNames))
|
||||||
for i, nm := range tt.nodeNames {
|
for i, nm := range tt.nodeNames {
|
||||||
|
@ -319,7 +319,6 @@ func (t *TestPlugin) Filter(ctx context.Context, state *framework.CycleState, po
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSchedulerMultipleProfilesScheduling(t *testing.T) {
|
func TestSchedulerMultipleProfilesScheduling(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
nodes := []runtime.Object{
|
nodes := []runtime.Object{
|
||||||
st.MakeNode().Name("node1").UID("node1").Obj(),
|
st.MakeNode().Name("node1").UID("node1").Obj(),
|
||||||
st.MakeNode().Name("node2").UID("node2").Obj(),
|
st.MakeNode().Name("node2").UID("node2").Obj(),
|
||||||
@ -446,7 +445,6 @@ func TestSchedulerMultipleProfilesScheduling(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSchedulerScheduleOne(t *testing.T) {
|
func TestSchedulerScheduleOne(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
testNode := v1.Node{ObjectMeta: metav1.ObjectMeta{Name: "node1", UID: types.UID("node1")}}
|
testNode := v1.Node{ObjectMeta: metav1.ObjectMeta{Name: "node1", UID: types.UID("node1")}}
|
||||||
client := clientsetfake.NewSimpleClientset(&testNode)
|
client := clientsetfake.NewSimpleClientset(&testNode)
|
||||||
eventBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{Interface: client.EventsV1()})
|
eventBroadcaster := events.NewBroadcaster(&events.EventSinkImpl{Interface: client.EventsV1()})
|
||||||
@ -641,7 +639,6 @@ func TestSchedulerScheduleOne(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSchedulerNoPhantomPodAfterExpire(t *testing.T) {
|
func TestSchedulerNoPhantomPodAfterExpire(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
queuedPodStore := clientcache.NewFIFO(clientcache.MetaNamespaceKeyFunc)
|
queuedPodStore := clientcache.NewFIFO(clientcache.MetaNamespaceKeyFunc)
|
||||||
@ -707,7 +704,6 @@ func TestSchedulerNoPhantomPodAfterExpire(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSchedulerNoPhantomPodAfterDelete(t *testing.T) {
|
func TestSchedulerNoPhantomPodAfterDelete(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
queuedPodStore := clientcache.NewFIFO(clientcache.MetaNamespaceKeyFunc)
|
queuedPodStore := clientcache.NewFIFO(clientcache.MetaNamespaceKeyFunc)
|
||||||
@ -777,7 +773,6 @@ func TestSchedulerNoPhantomPodAfterDelete(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSchedulerFailedSchedulingReasons(t *testing.T) {
|
func TestSchedulerFailedSchedulingReasons(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
queuedPodStore := clientcache.NewFIFO(clientcache.MetaNamespaceKeyFunc)
|
queuedPodStore := clientcache.NewFIFO(clientcache.MetaNamespaceKeyFunc)
|
||||||
@ -860,7 +855,6 @@ func TestSchedulerFailedSchedulingReasons(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSchedulerWithVolumeBinding(t *testing.T) {
|
func TestSchedulerWithVolumeBinding(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
findErr := fmt.Errorf("find err")
|
findErr := fmt.Errorf("find err")
|
||||||
assumeErr := fmt.Errorf("assume err")
|
assumeErr := fmt.Errorf("assume err")
|
||||||
bindErr := fmt.Errorf("bind err")
|
bindErr := fmt.Errorf("bind err")
|
||||||
@ -1007,7 +1001,6 @@ func TestSchedulerWithVolumeBinding(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSchedulerBinding(t *testing.T) {
|
func TestSchedulerBinding(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
table := []struct {
|
table := []struct {
|
||||||
podName string
|
podName string
|
||||||
extenders []framework.Extender
|
extenders []framework.Extender
|
||||||
@ -1043,9 +1036,7 @@ func TestSchedulerBinding(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range table {
|
for _, test := range table {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
pod := st.MakePod().Name(test.podName).Obj()
|
pod := st.MakePod().Name(test.podName).Obj()
|
||||||
defaultBound := false
|
defaultBound := false
|
||||||
client := clientsetfake.NewSimpleClientset(pod)
|
client := clientsetfake.NewSimpleClientset(pod)
|
||||||
@ -1093,7 +1084,6 @@ func TestSchedulerBinding(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUpdatePod(t *testing.T) {
|
func TestUpdatePod(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
currentPodConditions []v1.PodCondition
|
currentPodConditions []v1.PodCondition
|
||||||
@ -1235,9 +1225,7 @@ func TestUpdatePod(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
actualPatchRequests := 0
|
actualPatchRequests := 0
|
||||||
var actualPatchData string
|
var actualPatchData string
|
||||||
cs := &clientsetfake.Clientset{}
|
cs := &clientsetfake.Clientset{}
|
||||||
@ -1275,7 +1263,6 @@ func TestUpdatePod(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSelectHost(t *testing.T) {
|
func TestSelectHost(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
list framework.NodeScoreList
|
list framework.NodeScoreList
|
||||||
@ -1323,9 +1310,7 @@ func TestSelectHost(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
// increase the randomness
|
// increase the randomness
|
||||||
for i := 0; i < 10; i++ {
|
for i := 0; i < 10; i++ {
|
||||||
got, err := selectHost(test.list)
|
got, err := selectHost(test.list)
|
||||||
@ -1347,7 +1332,6 @@ func TestSelectHost(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFindNodesThatPassExtenders(t *testing.T) {
|
func TestFindNodesThatPassExtenders(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
extenders []st.FakeExtender
|
extenders []st.FakeExtender
|
||||||
@ -1499,9 +1483,7 @@ func TestFindNodesThatPassExtenders(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
var extenders []framework.Extender
|
var extenders []framework.Extender
|
||||||
for ii := range tt.extenders {
|
for ii := range tt.extenders {
|
||||||
extenders = append(extenders, &tt.extenders[ii])
|
extenders = append(extenders, &tt.extenders[ii])
|
||||||
@ -1529,7 +1511,6 @@ func TestFindNodesThatPassExtenders(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSchedulerSchedulePod(t *testing.T) {
|
func TestSchedulerSchedulePod(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
fts := feature.Features{}
|
fts := feature.Features{}
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
@ -1995,9 +1976,7 @@ func TestSchedulerSchedulePod(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
cache := internalcache.New(time.Duration(0), wait.NeverStop)
|
cache := internalcache.New(time.Duration(0), wait.NeverStop)
|
||||||
for _, pod := range test.pods {
|
for _, pod := range test.pods {
|
||||||
cache.AddPod(pod)
|
cache.AddPod(pod)
|
||||||
@ -2146,12 +2125,10 @@ func TestFindFitSomeError(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, node := range nodes {
|
for _, node := range nodes {
|
||||||
node := node
|
|
||||||
if node.Name == pod.Name {
|
if node.Name == pod.Name {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
t.Run(node.Name, func(t *testing.T) {
|
t.Run(node.Name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
status, found := diagnosis.NodeToStatusMap[node.Name]
|
status, found := diagnosis.NodeToStatusMap[node.Name]
|
||||||
if !found {
|
if !found {
|
||||||
t.Errorf("failed to find node %v in %v", node.Name, diagnosis.NodeToStatusMap)
|
t.Errorf("failed to find node %v in %v", node.Name, diagnosis.NodeToStatusMap)
|
||||||
@ -2232,7 +2209,6 @@ func TestFindFitPredicateCallCounts(t *testing.T) {
|
|||||||
// is the one being scheduled.
|
// is the one being scheduled.
|
||||||
// - don't get the same score no matter what we schedule.
|
// - don't get the same score no matter what we schedule.
|
||||||
func TestZeroRequest(t *testing.T) {
|
func TestZeroRequest(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
// A pod with no resources. We expect spreading to count it as having the default resources.
|
// A pod with no resources. We expect spreading to count it as having the default resources.
|
||||||
noResources := v1.PodSpec{
|
noResources := v1.PodSpec{
|
||||||
Containers: []v1.Container{
|
Containers: []v1.Container{
|
||||||
@ -2321,9 +2297,7 @@ func TestZeroRequest(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
client := clientsetfake.NewSimpleClientset()
|
client := clientsetfake.NewSimpleClientset()
|
||||||
informerFactory := informers.NewSharedInformerFactory(client, 0)
|
informerFactory := informers.NewSharedInformerFactory(client, 0)
|
||||||
|
|
||||||
@ -2383,7 +2357,6 @@ func TestZeroRequest(t *testing.T) {
|
|||||||
var lowPriority, midPriority, highPriority = int32(0), int32(100), int32(1000)
|
var lowPriority, midPriority, highPriority = int32(0), int32(100), int32(1000)
|
||||||
|
|
||||||
func TestNumFeasibleNodesToFind(t *testing.T) {
|
func TestNumFeasibleNodesToFind(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
percentageOfNodesToScore int32
|
percentageOfNodesToScore int32
|
||||||
@ -2425,9 +2398,7 @@ func TestNumFeasibleNodesToFind(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
sched := &Scheduler{
|
sched := &Scheduler{
|
||||||
percentageOfNodesToScore: tt.percentageOfNodesToScore,
|
percentageOfNodesToScore: tt.percentageOfNodesToScore,
|
||||||
}
|
}
|
||||||
@ -2482,7 +2453,6 @@ func TestFairEvaluationForNodes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPreferNominatedNodeFilterCallCounts(t *testing.T) {
|
func TestPreferNominatedNodeFilterCallCounts(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
pod *v1.Pod
|
pod *v1.Pod
|
||||||
@ -2509,9 +2479,7 @@ func TestPreferNominatedNodeFilterCallCounts(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
test := test
|
|
||||||
t.Run(test.name, func(t *testing.T) {
|
t.Run(test.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
// create three nodes in the cluster.
|
// create three nodes in the cluster.
|
||||||
nodes := makeNodeList([]string{"node1", "node2", "node3"})
|
nodes := makeNodeList([]string{"node1", "node2", "node3"})
|
||||||
client := clientsetfake.NewSimpleClientset(test.pod)
|
client := clientsetfake.NewSimpleClientset(test.pod)
|
||||||
|
@ -49,7 +49,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestSchedulerCreation(t *testing.T) {
|
func TestSchedulerCreation(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
invalidRegistry := map[string]frameworkruntime.PluginFactory{
|
invalidRegistry := map[string]frameworkruntime.PluginFactory{
|
||||||
defaultbinder.Name: defaultbinder.New,
|
defaultbinder.Name: defaultbinder.New,
|
||||||
}
|
}
|
||||||
@ -167,9 +166,7 @@ func TestSchedulerCreation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
tc := tc
|
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
client := fake.NewSimpleClientset()
|
client := fake.NewSimpleClientset()
|
||||||
informerFactory := informers.NewSharedInformerFactory(client, 0)
|
informerFactory := informers.NewSharedInformerFactory(client, 0)
|
||||||
|
|
||||||
@ -234,7 +231,6 @@ func TestSchedulerCreation(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFailureHandler(t *testing.T) {
|
func TestFailureHandler(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
testPod := st.MakePod().Name("test-pod").Namespace(v1.NamespaceDefault).Obj()
|
testPod := st.MakePod().Name("test-pod").Namespace(v1.NamespaceDefault).Obj()
|
||||||
testPodUpdated := testPod.DeepCopy()
|
testPodUpdated := testPod.DeepCopy()
|
||||||
testPodUpdated.Labels = map[string]string{"foo": ""}
|
testPodUpdated.Labels = map[string]string{"foo": ""}
|
||||||
@ -266,9 +262,7 @@ func TestFailureHandler(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
@ -320,7 +314,6 @@ func TestFailureHandler(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFailureHandler_NodeNotFound(t *testing.T) {
|
func TestFailureHandler_NodeNotFound(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
nodeFoo := &v1.Node{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}
|
nodeFoo := &v1.Node{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}
|
||||||
nodeBar := &v1.Node{ObjectMeta: metav1.ObjectMeta{Name: "bar"}}
|
nodeBar := &v1.Node{ObjectMeta: metav1.ObjectMeta{Name: "bar"}}
|
||||||
testPod := st.MakePod().Name("test-pod").Namespace(v1.NamespaceDefault).Obj()
|
testPod := st.MakePod().Name("test-pod").Namespace(v1.NamespaceDefault).Obj()
|
||||||
@ -347,9 +340,7 @@ func TestFailureHandler_NodeNotFound(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
@ -392,7 +383,6 @@ func TestFailureHandler_NodeNotFound(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFailureHandler_PodAlreadyBound(t *testing.T) {
|
func TestFailureHandler_PodAlreadyBound(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
@ -486,7 +476,6 @@ func initScheduler(stop <-chan struct{}, cache internalcache.Cache, queue intern
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestInitPluginsWithIndexers(t *testing.T) {
|
func TestInitPluginsWithIndexers(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
// the plugin registration ordering must not matter, being map traversal random
|
// the plugin registration ordering must not matter, being map traversal random
|
||||||
@ -549,9 +538,7 @@ func TestInitPluginsWithIndexers(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
tt := tt
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
t.Parallel()
|
|
||||||
fakeInformerFactory := NewInformerFactory(&fake.Clientset{}, 0*time.Second)
|
fakeInformerFactory := NewInformerFactory(&fake.Clientset{}, 0*time.Second)
|
||||||
|
|
||||||
var registerPluginFuncs []st.RegisterPluginFunc
|
var registerPluginFuncs []st.RegisterPluginFunc
|
||||||
|
Loading…
Reference in New Issue
Block a user