Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from kubernetes:master #3607

Merged
merged 7 commits into from
Sep 23, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "Enable paralellism in scheduler unit tests"
This reverts commit f37ab16.

Signed-off-by: Monis Khan <mok@microsoft.com>
  • Loading branch information
enj committed Sep 23, 2022
commit f01295067ffe4b6c6de95572141664c8939bebc8
24 changes: 0 additions & 24 deletions pkg/scheduler/eventhandlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import (
)

func TestNodeAllocatableChanged(t *testing.T) {
t.Parallel()
newQuantity := func(value int64) resource.Quantity {
return *resource.NewQuantity(value, resource.BinarySI)
}
Expand All @@ -71,9 +70,7 @@ func TestNodeAllocatableChanged(t *testing.T) {
NewAllocatable: v1.ResourceList{v1.ResourceMemory: newQuantity(1024), v1.ResourceStorage: newQuantity(1024)},
},
} {
test := test
t.Run(test.Name, func(t *testing.T) {
t.Parallel()
oldNode := &v1.Node{Status: v1.NodeStatus{Allocatable: test.OldAllocatable}}
newNode := &v1.Node{Status: v1.NodeStatus{Allocatable: test.NewAllocatable}}
changed := nodeAllocatableChanged(newNode, oldNode)
Expand All @@ -85,7 +82,6 @@ func TestNodeAllocatableChanged(t *testing.T) {
}

func TestNodeLabelsChanged(t *testing.T) {
t.Parallel()
for _, test := range []struct {
Name string
Changed bool
Expand All @@ -106,9 +102,7 @@ func TestNodeLabelsChanged(t *testing.T) {
NewLabels: map[string]string{"foo": "bar", "test": "value"},
},
} {
test := test
t.Run(test.Name, func(t *testing.T) {
t.Parallel()
oldNode := &v1.Node{ObjectMeta: metav1.ObjectMeta{Labels: test.OldLabels}}
newNode := &v1.Node{ObjectMeta: metav1.ObjectMeta{Labels: test.NewLabels}}
changed := nodeLabelsChanged(newNode, oldNode)
Expand All @@ -120,7 +114,6 @@ func TestNodeLabelsChanged(t *testing.T) {
}

func TestNodeTaintsChanged(t *testing.T) {
t.Parallel()
for _, test := range []struct {
Name string
Changed bool
Expand All @@ -140,9 +133,7 @@ func TestNodeTaintsChanged(t *testing.T) {
NewTaints: []v1.Taint{{Key: "key", Value: "value2"}},
},
} {
test := test
t.Run(test.Name, func(t *testing.T) {
t.Parallel()
oldNode := &v1.Node{Spec: v1.NodeSpec{Taints: test.OldTaints}}
newNode := &v1.Node{Spec: v1.NodeSpec{Taints: test.NewTaints}}
changed := nodeTaintsChanged(newNode, oldNode)
Expand All @@ -154,7 +145,6 @@ func TestNodeTaintsChanged(t *testing.T) {
}

func TestNodeConditionsChanged(t *testing.T) {
t.Parallel()
nodeConditionType := reflect.TypeOf(v1.NodeCondition{})
if nodeConditionType.NumField() != 6 {
t.Errorf("NodeCondition type has changed. The nodeConditionsChanged() function must be reevaluated.")
Expand Down Expand Up @@ -197,9 +187,7 @@ func TestNodeConditionsChanged(t *testing.T) {
NewConditions: []v1.NodeCondition{{Type: v1.NodeReady, Status: v1.ConditionTrue}},
},
} {
test := test
t.Run(test.Name, func(t *testing.T) {
t.Parallel()
oldNode := &v1.Node{Status: v1.NodeStatus{Conditions: test.OldConditions}}
newNode := &v1.Node{Status: v1.NodeStatus{Conditions: test.NewConditions}}
changed := nodeConditionsChanged(newNode, oldNode)
Expand All @@ -211,7 +199,6 @@ func TestNodeConditionsChanged(t *testing.T) {
}

func TestUpdatePodInCache(t *testing.T) {
t.Parallel()
ttl := 10 * time.Second
nodeName := "node"

Expand All @@ -232,9 +219,7 @@ func TestUpdatePodInCache(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
sched := &Scheduler{
Expand Down Expand Up @@ -266,7 +251,6 @@ func withPodName(pod *v1.Pod, name string) *v1.Pod {
}

func TestPreCheckForNode(t *testing.T) {
t.Parallel()
cpu4 := map[v1.ResourceName]string{v1.ResourceCPU: "4"}
cpu8 := map[v1.ResourceName]string{v1.ResourceCPU: "8"}
cpu16 := map[v1.ResourceName]string{v1.ResourceCPU: "16"}
Expand Down Expand Up @@ -353,9 +337,7 @@ func TestPreCheckForNode(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
nodeInfo := framework.NewNodeInfo(tt.existingPods...)
nodeInfo.SetNode(tt.nodeFn())
preCheckFn := preCheckForNode(nodeInfo)
Expand All @@ -374,7 +356,6 @@ func TestPreCheckForNode(t *testing.T) {

// test for informers of resources we care about is registered
func TestAddAllEventHandlers(t *testing.T) {
t.Parallel()
tests := []struct {
name string
gvkMap map[framework.GVK]framework.ActionType
Expand Down Expand Up @@ -448,9 +429,7 @@ func TestAddAllEventHandlers(t *testing.T) {
localSchemeBuilder.AddToScheme(scheme)

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
ctx, cancel := context.WithCancel(context.Background())
defer cancel()

Expand Down Expand Up @@ -482,7 +461,6 @@ func TestAddAllEventHandlers(t *testing.T) {
}

func TestAdmissionCheck(t *testing.T) {
t.Parallel()
nodeaffinityError := AdmissionResult{Name: nodeaffinity.Name, Reason: nodeaffinity.ErrReasonPod}
nodenameError := AdmissionResult{Name: nodename.Name, Reason: nodename.ErrReason}
nodeportsError := AdmissionResult{Name: nodeports.Name, Reason: nodeports.ErrReason}
Expand Down Expand Up @@ -524,9 +502,7 @@ func TestAdmissionCheck(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
nodeInfo := framework.NewNodeInfo(tt.existingPods...)
nodeInfo.SetNode(tt.node)

Expand Down
10 changes: 0 additions & 10 deletions pkg/scheduler/extender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import (
)

func TestSchedulerWithExtenders(t *testing.T) {
t.Parallel()
tests := []struct {
name string
registerPlugins []st.RegisterPluginFunc
Expand Down Expand Up @@ -331,7 +330,6 @@ func createNode(name string) *v1.Node {
}

func TestIsInterested(t *testing.T) {
t.Parallel()
mem := &HTTPExtender{
managedResources: sets.NewString(),
}
Expand Down Expand Up @@ -374,9 +372,7 @@ func TestIsInterested(t *testing.T) {
want: true,
},
} {
tc := tc
t.Run(tc.label, func(t *testing.T) {
t.Parallel()
if got := tc.extender.IsInterested(tc.pod); got != tc.want {
t.Fatalf("IsInterested(%v) = %v, wanted %v", tc.pod, got, tc.want)
}
Expand All @@ -385,7 +381,6 @@ func TestIsInterested(t *testing.T) {
}

func TestConvertToMetaVictims(t *testing.T) {
t.Parallel()
tests := []struct {
name string
nodeNameToVictims map[string]*extenderv1.Victims
Expand Down Expand Up @@ -428,9 +423,7 @@ func TestConvertToMetaVictims(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
if got := convertToMetaVictims(tt.nodeNameToVictims); !reflect.DeepEqual(got, tt.want) {
t.Errorf("convertToMetaVictims() = %v, want %v", got, tt.want)
}
Expand All @@ -439,7 +432,6 @@ func TestConvertToMetaVictims(t *testing.T) {
}

func TestConvertToVictims(t *testing.T) {
t.Parallel()
tests := []struct {
name string
httpExtender *HTTPExtender
Expand Down Expand Up @@ -496,9 +488,7 @@ func TestConvertToVictims(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
// nodeInfos instantiations
nodeInfoList := make([]*framework.NodeInfo, 0, len(tt.nodeNames))
for i, nm := range tt.nodeNames {
Expand Down
Loading