@@ -153,7 +153,7 @@ func TestPriorityQueue_Add(t *testing.T) {
153
153
t .Errorf ("Expected: %v after Pop, but got: %v" , unschedulablePodInfo .Pod .Name , p .Pod .Name )
154
154
}
155
155
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" ])
157
157
}
158
158
}
159
159
@@ -881,7 +881,7 @@ func TestPriorityQueue_AddUnschedulableIfNotPresent(t *testing.T) {
881
881
t .Errorf ("Expected: %v after Pop, but got: %v" , highPriNominatedPodInfo .Pod .Name , p .Pod .Name )
882
882
}
883
883
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 )
885
885
}
886
886
// unschedulablePodInfo is inserted to unschedulable pod pool because no events happened during scheduling.
887
887
if getUnschedulablePod (q , unschedulablePodInfo .Pod ) != unschedulablePodInfo .Pod {
@@ -967,7 +967,7 @@ func TestPriorityQueue_Pop(t *testing.T) {
967
967
t .Errorf ("Expected: %v after Pop, but got: %v" , medPriorityPodInfo .Pod .Name , p .Pod .Name )
968
968
}
969
969
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" ])
971
971
}
972
972
}()
973
973
q .Add (logger , medPriorityPodInfo .Pod )
@@ -1165,7 +1165,7 @@ func TestPriorityQueue_Update(t *testing.T) {
1165
1165
}
1166
1166
1167
1167
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 )
1169
1169
}
1170
1170
1171
1171
})
@@ -1212,7 +1212,7 @@ func TestPriorityQueue_UpdateWhenInflight(t *testing.T) {
1212
1212
}
1213
1213
1214
1214
if err := q .Update (logger , testPod , updatedPod ); err != nil {
1215
- t .Error ("Error calling Update" )
1215
+ t .Errorf ("Error calling Update: %v" , err )
1216
1216
}
1217
1217
// test-pod got rejected by fakePlugin,
1218
1218
// but the update event that it just got may change this scheduling result,
@@ -1251,13 +1251,13 @@ func TestPriorityQueue_Delete(t *testing.T) {
1251
1251
t .Errorf ("Didn't expect %v to be in activeQ." , highPriorityPodInfo .Pod .Name )
1252
1252
}
1253
1253
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 )
1255
1255
}
1256
1256
if err := q .Delete (unschedulablePodInfo .Pod ); err != nil {
1257
1257
t .Errorf ("delete failed: %v" , err )
1258
1258
}
1259
1259
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 )
1261
1261
}
1262
1262
}
1263
1263
@@ -2016,23 +2016,23 @@ func TestPriorityQueue_NominatedPodDeleted(t *testing.T) {
2016
2016
name string
2017
2017
podInfo * framework.PodInfo
2018
2018
deletePod bool
2019
- want bool
2019
+ wantLen int
2020
2020
}{
2021
2021
{
2022
2022
name : "alive pod gets added into PodNominator" ,
2023
2023
podInfo : medPriorityPodInfo ,
2024
- want : true ,
2024
+ wantLen : 1 ,
2025
2025
},
2026
2026
{
2027
2027
name : "deleted pod shouldn't be added into PodNominator" ,
2028
2028
podInfo : highPriNominatedPodInfo ,
2029
2029
deletePod : true ,
2030
- want : false ,
2030
+ wantLen : 0 ,
2031
2031
},
2032
2032
{
2033
2033
name : "pod without .status.nominatedPodName specified shouldn't be added into PodNominator" ,
2034
2034
podInfo : highPriorityPodInfo ,
2035
- want : false ,
2035
+ wantLen : 0 ,
2036
2036
},
2037
2037
}
2038
2038
@@ -2057,8 +2057,8 @@ func TestPriorityQueue_NominatedPodDeleted(t *testing.T) {
2057
2057
2058
2058
q .AddNominatedPod (logger , tt .podInfo , nil )
2059
2059
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 )
2062
2062
}
2063
2063
})
2064
2064
}
@@ -3884,21 +3884,21 @@ func Test_queuedPodInfo_gatedSetUponCreationAndUnsetUponUpdate(t *testing.T) {
3884
3884
3885
3885
gatedPod := st .MakePod ().SchedulingGates ([]string {"hello world" }).Obj ()
3886
3886
if err := q .Add (logger , gatedPod ); err != nil {
3887
- t .Error ("Error calling Add" )
3887
+ t .Errorf ("Error while adding gated pod: %v" , err )
3888
3888
}
3889
3889
3890
3890
if ! q .unschedulablePods .get (gatedPod ).Gated {
3891
- t .Error ("expected pod to be gated" )
3891
+ t .Error ("Expected pod to be gated" )
3892
3892
}
3893
3893
3894
3894
ungatedPod := gatedPod .DeepCopy ()
3895
3895
ungatedPod .Spec .SchedulingGates = nil
3896
3896
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 )
3898
3898
}
3899
3899
3900
3900
ungatedPodInfo , _ := q .Pop (logger )
3901
3901
if ungatedPodInfo .Gated {
3902
- t .Error ("expected pod to be ungated" )
3902
+ t .Error ("Expected pod to be ungated" )
3903
3903
}
3904
3904
}
0 commit comments