Skip to content

Commit c5d376d

Browse files
committed
Fix typos and error messages in scheduling queue tests
1 parent d729af9 commit c5d376d

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

pkg/scheduler/internal/queue/scheduling_queue_test.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func TestPriorityQueue_Add(t *testing.T) {
153153
t.Errorf("Expected: %v after Pop, but got: %v", unschedulablePodInfo.Pod.Name, p.Pod.Name)
154154
}
155155
if len(q.nominator.nominatedPods["node1"]) != 2 {
156-
t.Errorf("Expected medPriorityPodInfo and unschedulablePodInfo to be still present in nomindatePods: %v", q.nominator.nominatedPods["node1"])
156+
t.Errorf("Expected medPriorityPodInfo and unschedulablePodInfo to be still present in nominatedPods: %v", q.nominator.nominatedPods["node1"])
157157
}
158158
}
159159

@@ -881,7 +881,7 @@ func TestPriorityQueue_AddUnschedulableIfNotPresent(t *testing.T) {
881881
t.Errorf("Expected: %v after Pop, but got: %v", highPriNominatedPodInfo.Pod.Name, p.Pod.Name)
882882
}
883883
if len(q.nominator.nominatedPods) != 1 {
884-
t.Errorf("Expected nomindatePods to have one element: %v", q.nominator)
884+
t.Errorf("Expected nominatedPods to have one element: %v", q.nominator)
885885
}
886886
// unschedulablePodInfo is inserted to unschedulable pod pool because no events happened during scheduling.
887887
if getUnschedulablePod(q, unschedulablePodInfo.Pod) != unschedulablePodInfo.Pod {
@@ -967,7 +967,7 @@ func TestPriorityQueue_Pop(t *testing.T) {
967967
t.Errorf("Expected: %v after Pop, but got: %v", medPriorityPodInfo.Pod.Name, p.Pod.Name)
968968
}
969969
if len(q.nominator.nominatedPods["node1"]) != 1 {
970-
t.Errorf("Expected medPriorityPodInfo to be present in nomindatePods: %v", q.nominator.nominatedPods["node1"])
970+
t.Errorf("Expected medPriorityPodInfo to be present in nominatedPods: %v", q.nominator.nominatedPods["node1"])
971971
}
972972
}()
973973
q.Add(logger, medPriorityPodInfo.Pod)
@@ -1165,7 +1165,7 @@ func TestPriorityQueue_Update(t *testing.T) {
11651165
}
11661166

11671167
if tt.wantAddedToNominated && len(q.nominator.nominatedPods) != 1 {
1168-
t.Errorf("Expected one item in nomindatePods map: %v", q.nominator)
1168+
t.Errorf("Expected one item in nominatedPods map: %v", q.nominator)
11691169
}
11701170

11711171
})
@@ -1212,7 +1212,7 @@ func TestPriorityQueue_UpdateWhenInflight(t *testing.T) {
12121212
}
12131213

12141214
if err := q.Update(logger, testPod, updatedPod); err != nil {
1215-
t.Error("Error calling Update")
1215+
t.Errorf("Error calling Update: %v", err)
12161216
}
12171217
// test-pod got rejected by fakePlugin,
12181218
// but the update event that it just got may change this scheduling result,
@@ -1251,13 +1251,13 @@ func TestPriorityQueue_Delete(t *testing.T) {
12511251
t.Errorf("Didn't expect %v to be in activeQ.", highPriorityPodInfo.Pod.Name)
12521252
}
12531253
if len(q.nominator.nominatedPods) != 1 {
1254-
t.Errorf("Expected nomindatePods to have only 'unschedulablePodInfo': %v", q.nominator.nominatedPods)
1254+
t.Errorf("Expected nominatedPods to have only 'unschedulablePodInfo': %v", q.nominator.nominatedPods)
12551255
}
12561256
if err := q.Delete(unschedulablePodInfo.Pod); err != nil {
12571257
t.Errorf("delete failed: %v", err)
12581258
}
12591259
if len(q.nominator.nominatedPods) != 0 {
1260-
t.Errorf("Expected nomindatePods to be empty: %v", q.nominator)
1260+
t.Errorf("Expected nominatedPods to be empty: %v", q.nominator)
12611261
}
12621262
}
12631263

@@ -2016,23 +2016,23 @@ func TestPriorityQueue_NominatedPodDeleted(t *testing.T) {
20162016
name string
20172017
podInfo *framework.PodInfo
20182018
deletePod bool
2019-
want bool
2019+
wantLen int
20202020
}{
20212021
{
20222022
name: "alive pod gets added into PodNominator",
20232023
podInfo: medPriorityPodInfo,
2024-
want: true,
2024+
wantLen: 1,
20252025
},
20262026
{
20272027
name: "deleted pod shouldn't be added into PodNominator",
20282028
podInfo: highPriNominatedPodInfo,
20292029
deletePod: true,
2030-
want: false,
2030+
wantLen: 0,
20312031
},
20322032
{
20332033
name: "pod without .status.nominatedPodName specified shouldn't be added into PodNominator",
20342034
podInfo: highPriorityPodInfo,
2035-
want: false,
2035+
wantLen: 0,
20362036
},
20372037
}
20382038

@@ -2057,8 +2057,8 @@ func TestPriorityQueue_NominatedPodDeleted(t *testing.T) {
20572057

20582058
q.AddNominatedPod(logger, tt.podInfo, nil)
20592059

2060-
if got := len(q.NominatedPodsForNode(tt.podInfo.Pod.Status.NominatedNodeName)) == 1; got != tt.want {
2061-
t.Errorf("Want %v, but got %v", tt.want, got)
2060+
if got := len(q.NominatedPodsForNode(tt.podInfo.Pod.Status.NominatedNodeName)); got != tt.wantLen {
2061+
t.Errorf("Expected %v nominated pods for node, but got %v", tt.wantLen, got)
20622062
}
20632063
})
20642064
}
@@ -3884,21 +3884,21 @@ func Test_queuedPodInfo_gatedSetUponCreationAndUnsetUponUpdate(t *testing.T) {
38843884

38853885
gatedPod := st.MakePod().SchedulingGates([]string{"hello world"}).Obj()
38863886
if err := q.Add(logger, gatedPod); err != nil {
3887-
t.Error("Error calling Add")
3887+
t.Errorf("Error while adding gated pod: %v", err)
38883888
}
38893889

38903890
if !q.unschedulablePods.get(gatedPod).Gated {
3891-
t.Error("expected pod to be gated")
3891+
t.Error("Expected pod to be gated")
38923892
}
38933893

38943894
ungatedPod := gatedPod.DeepCopy()
38953895
ungatedPod.Spec.SchedulingGates = nil
38963896
if err := q.Update(logger, gatedPod, ungatedPod); err != nil {
3897-
t.Error("Error calling Update")
3897+
t.Errorf("Error while updating pod to ungated: %v", err)
38983898
}
38993899

39003900
ungatedPodInfo, _ := q.Pop(logger)
39013901
if ungatedPodInfo.Gated {
3902-
t.Error("expected pod to be ungated")
3902+
t.Error("Expected pod to be ungated")
39033903
}
39043904
}

0 commit comments

Comments
 (0)