@@ -77,9 +77,9 @@ type BindPlugin struct {
77
77
pluginInvokeEventChan chan pluginInvokeEvent
78
78
}
79
79
80
- type PostbindPlugin struct {
80
+ type PostBindPlugin struct {
81
81
name string
82
- numPostbindCalled int
82
+ numPostBindCalled int
83
83
pluginInvokeEventChan chan pluginInvokeEvent
84
84
}
85
85
@@ -109,7 +109,7 @@ const (
109
109
reservePluginName = "reserve-plugin"
110
110
prebindPluginName = "prebind-plugin"
111
111
unreservePluginName = "unreserve-plugin"
112
- postbindPluginName = "postbind-plugin"
112
+ postBindPluginName = "postbind-plugin"
113
113
permitPluginName = "permit-plugin"
114
114
)
115
115
@@ -122,7 +122,7 @@ var _ = framework.ReservePlugin(&ReservePlugin{})
122
122
var _ = framework .PostFilterPlugin (& PostFilterPlugin {})
123
123
var _ = framework .PrebindPlugin (& PrebindPlugin {})
124
124
var _ = framework .BindPlugin (& BindPlugin {})
125
- var _ = framework .PostbindPlugin ( & PostbindPlugin {})
125
+ var _ = framework .PostBindPlugin ( & PostBindPlugin {})
126
126
var _ = framework .UnreservePlugin (& UnreservePlugin {})
127
127
var _ = framework .PermitPlugin (& PermitPlugin {})
128
128
@@ -303,21 +303,21 @@ func (bp *BindPlugin) reset() {
303
303
}
304
304
305
305
// Name returns name of the plugin.
306
- func (pp * PostbindPlugin ) Name () string {
306
+ func (pp * PostBindPlugin ) Name () string {
307
307
return pp .name
308
308
}
309
309
310
- // Postbind is a test function, which counts the number of times called.
311
- func (pp * PostbindPlugin ) Postbind (pc * framework.PluginContext , pod * v1.Pod , nodeName string ) {
312
- pp .numPostbindCalled ++
310
+ // PostBind is a test function, which counts the number of times called.
311
+ func (pp * PostBindPlugin ) PostBind (pc * framework.PluginContext , pod * v1.Pod , nodeName string ) {
312
+ pp .numPostBindCalled ++
313
313
if pp .pluginInvokeEventChan != nil {
314
- pp .pluginInvokeEventChan <- pluginInvokeEvent {pluginName : pp .Name (), val : pp .numPostbindCalled }
314
+ pp .pluginInvokeEventChan <- pluginInvokeEvent {pluginName : pp .Name (), val : pp .numPostBindCalled }
315
315
}
316
316
}
317
317
318
318
// reset used to reset postbind plugin.
319
- func (pp * PostbindPlugin ) reset () {
320
- pp .numPostbindCalled = 0
319
+ func (pp * PostBindPlugin ) reset () {
320
+ pp .numPostBindCalled = 0
321
321
}
322
322
323
323
// Name returns name of the plugin.
@@ -884,7 +884,7 @@ func TestBindPlugin(t *testing.T) {
884
884
bindPlugin1 := & BindPlugin {PluginName : "bind-plugin-1" , client : testContext .clientSet }
885
885
bindPlugin2 := & BindPlugin {PluginName : "bind-plugin-2" , client : testContext .clientSet }
886
886
unreservePlugin := & UnreservePlugin {name : "mock-unreserve-plugin" }
887
- postbindPlugin := & PostbindPlugin {name : "mock-post-bind-plugin" }
887
+ postBindPlugin := & PostBindPlugin {name : "mock-post-bind-plugin" }
888
888
// Create a plugin registry for testing. Register an unreserve, a bind plugin and a postBind plugin.
889
889
registry := framework.Registry {
890
890
unreservePlugin .Name (): func (_ * runtime.Unknown , _ framework.FrameworkHandle ) (framework.Plugin , error ) {
@@ -896,8 +896,8 @@ func TestBindPlugin(t *testing.T) {
896
896
bindPlugin2 .Name (): func (_ * runtime.Unknown , _ framework.FrameworkHandle ) (framework.Plugin , error ) {
897
897
return bindPlugin2 , nil
898
898
},
899
- postbindPlugin .Name (): func (_ * runtime.Unknown , _ framework.FrameworkHandle ) (framework.Plugin , error ) {
900
- return postbindPlugin , nil
899
+ postBindPlugin .Name (): func (_ * runtime.Unknown , _ framework.FrameworkHandle ) (framework.Plugin , error ) {
900
+ return postBindPlugin , nil
901
901
},
902
902
}
903
903
@@ -910,7 +910,7 @@ func TestBindPlugin(t *testing.T) {
910
910
Enabled : []schedulerconfig.Plugin {{Name : bindPlugin1 .Name ()}, {Name : bindPlugin2 .Name ()}},
911
911
},
912
912
PostBind : & schedulerconfig.PluginSet {
913
- Enabled : []schedulerconfig.Plugin {{Name : postbindPlugin .Name ()}},
913
+ Enabled : []schedulerconfig.Plugin {{Name : postBindPlugin .Name ()}},
914
914
},
915
915
}
916
916
// Set reserve and bind config for testing
@@ -928,7 +928,7 @@ func TestBindPlugin(t *testing.T) {
928
928
Args : runtime.Unknown {},
929
929
},
930
930
{
931
- Name : postbindPlugin .Name (),
931
+ Name : postBindPlugin .Name (),
932
932
Args : runtime.Unknown {},
933
933
},
934
934
}
@@ -956,21 +956,21 @@ func TestBindPlugin(t *testing.T) {
956
956
{
957
957
bindPluginStatuses : []* framework.Status {framework .NewStatus (framework .Skip , "" ), framework .NewStatus (framework .Skip , "" )},
958
958
expectBoundByScheduler : true ,
959
- expectInvokeEvents : []pluginInvokeEvent {{pluginName : bindPlugin1 .Name (), val : 1 }, {pluginName : bindPlugin2 .Name (), val : 1 }, {pluginName : postbindPlugin .Name (), val : 1 }},
959
+ expectInvokeEvents : []pluginInvokeEvent {{pluginName : bindPlugin1 .Name (), val : 1 }, {pluginName : bindPlugin2 .Name (), val : 1 }, {pluginName : postBindPlugin .Name (), val : 1 }},
960
960
},
961
961
// bindplugin2 succeeded to bind the pod
962
962
{
963
963
bindPluginStatuses : []* framework.Status {framework .NewStatus (framework .Skip , "" ), framework .NewStatus (framework .Success , "" )},
964
964
expectBoundByPlugin : true ,
965
965
expectBindPluginName : bindPlugin2 .Name (),
966
- expectInvokeEvents : []pluginInvokeEvent {{pluginName : bindPlugin1 .Name (), val : 1 }, {pluginName : bindPlugin2 .Name (), val : 1 }, {pluginName : postbindPlugin .Name (), val : 1 }},
966
+ expectInvokeEvents : []pluginInvokeEvent {{pluginName : bindPlugin1 .Name (), val : 1 }, {pluginName : bindPlugin2 .Name (), val : 1 }, {pluginName : postBindPlugin .Name (), val : 1 }},
967
967
},
968
968
// bindplugin1 succeeded to bind the pod
969
969
{
970
970
bindPluginStatuses : []* framework.Status {framework .NewStatus (framework .Success , "" ), framework .NewStatus (framework .Success , "" )},
971
971
expectBoundByPlugin : true ,
972
972
expectBindPluginName : bindPlugin1 .Name (),
973
- expectInvokeEvents : []pluginInvokeEvent {{pluginName : bindPlugin1 .Name (), val : 1 }, {pluginName : postbindPlugin .Name (), val : 1 }},
973
+ expectInvokeEvents : []pluginInvokeEvent {{pluginName : bindPlugin1 .Name (), val : 1 }, {pluginName : postBindPlugin .Name (), val : 1 }},
974
974
},
975
975
// bind plugin fails to bind the pod
976
976
{
@@ -988,7 +988,7 @@ func TestBindPlugin(t *testing.T) {
988
988
bindPlugin1 .pluginInvokeEventChan = pluginInvokeEventChan
989
989
bindPlugin2 .pluginInvokeEventChan = pluginInvokeEventChan
990
990
unreservePlugin .pluginInvokeEventChan = pluginInvokeEventChan
991
- postbindPlugin .pluginInvokeEventChan = pluginInvokeEventChan
991
+ postBindPlugin .pluginInvokeEventChan = pluginInvokeEventChan
992
992
993
993
// Create a best effort pod.
994
994
pod , err := createPausePod (cs ,
@@ -1027,9 +1027,9 @@ func TestBindPlugin(t *testing.T) {
1027
1027
}
1028
1028
}
1029
1029
if err = wait .Poll (10 * time .Millisecond , 30 * time .Second , func () (done bool , err error ) {
1030
- return postbindPlugin . numPostbindCalled == 1 , nil
1030
+ return postBindPlugin . numPostBindCalled == 1 , nil
1031
1031
}); err != nil {
1032
- t .Errorf ("test #%v: Expected the postbind plugin to be called once, was called %d times." , i , postbindPlugin . numPostbindCalled )
1032
+ t .Errorf ("test #%v: Expected the postbind plugin to be called once, was called %d times." , i , postBindPlugin . numPostBindCalled )
1033
1033
}
1034
1034
if unreservePlugin .numUnreserveCalled != 0 {
1035
1035
t .Errorf ("test #%v: Expected the unreserve plugin not to be called, was called %d times." , i , unreservePlugin .numUnreserveCalled )
@@ -1039,8 +1039,8 @@ func TestBindPlugin(t *testing.T) {
1039
1039
if err = wait .Poll (10 * time .Millisecond , 30 * time .Second , podSchedulingError (cs , pod .Namespace , pod .Name )); err != nil {
1040
1040
t .Errorf ("test #%v: Expected a scheduling error, but didn't get it. error: %v" , i , err )
1041
1041
}
1042
- if postbindPlugin . numPostbindCalled > 0 {
1043
- t .Errorf ("test #%v: Didn't expected the postbind plugin to be called %d times." , i , postbindPlugin . numPostbindCalled )
1042
+ if postBindPlugin . numPostBindCalled > 0 {
1043
+ t .Errorf ("test #%v: Didn't expected the postbind plugin to be called %d times." , i , postBindPlugin . numPostBindCalled )
1044
1044
}
1045
1045
}
1046
1046
for j := range test .expectInvokeEvents {
@@ -1057,22 +1057,22 @@ func TestBindPlugin(t *testing.T) {
1057
1057
t .Errorf ("test #%v: Waiting for invoke event %d timeout." , i , j )
1058
1058
}
1059
1059
}
1060
- postbindPlugin .reset ()
1060
+ postBindPlugin .reset ()
1061
1061
bindPlugin1 .reset ()
1062
1062
bindPlugin2 .reset ()
1063
1063
unreservePlugin .reset ()
1064
1064
cleanupPods (cs , t , []* v1.Pod {pod })
1065
1065
}
1066
1066
}
1067
1067
1068
- // TestPostbindPlugin tests invocation of postbind plugins.
1069
- func TestPostbindPlugin (t * testing.T ) {
1068
+ // TestPostBindPlugin tests invocation of postbind plugins.
1069
+ func TestPostBindPlugin (t * testing.T ) {
1070
1070
// Create a plugin registry for testing. Register a prebind and a postbind plugin.
1071
1071
prebindPlugin := & PrebindPlugin {}
1072
- postbindPlugin := & PostbindPlugin {name : postbindPluginName }
1072
+ postBindPlugin := & PostBindPlugin {name : postBindPluginName }
1073
1073
registry := framework.Registry {
1074
1074
prebindPluginName : newPlugin (prebindPlugin ),
1075
- postbindPluginName : newPlugin (postbindPlugin ),
1075
+ postBindPluginName : newPlugin (postBindPlugin ),
1076
1076
}
1077
1077
1078
1078
// Setup initial prebind and postbind plugin for testing.
@@ -1087,7 +1087,7 @@ func TestPostbindPlugin(t *testing.T) {
1087
1087
PostBind : & schedulerconfig.PluginSet {
1088
1088
Enabled : []schedulerconfig.Plugin {
1089
1089
{
1090
- Name : postbindPluginName ,
1090
+ Name : postBindPluginName ,
1091
1091
},
1092
1092
},
1093
1093
},
@@ -1099,7 +1099,7 @@ func TestPostbindPlugin(t *testing.T) {
1099
1099
Args : runtime.Unknown {},
1100
1100
},
1101
1101
{
1102
- Name : postbindPluginName ,
1102
+ Name : postBindPluginName ,
1103
1103
Args : runtime.Unknown {},
1104
1104
},
1105
1105
}
@@ -1154,28 +1154,28 @@ func TestPostbindPlugin(t *testing.T) {
1154
1154
if err = wait .Poll (10 * time .Millisecond , 30 * time .Second , podSchedulingError (cs , pod .Namespace , pod .Name )); err != nil {
1155
1155
t .Errorf ("test #%v: Expected a scheduling error, but didn't get it. error: %v" , i , err )
1156
1156
}
1157
- if postbindPlugin . numPostbindCalled > 0 {
1158
- t .Errorf ("test #%v: Didn't expected the postbind plugin to be called %d times." , i , postbindPlugin . numPostbindCalled )
1157
+ if postBindPlugin . numPostBindCalled > 0 {
1158
+ t .Errorf ("test #%v: Didn't expected the postbind plugin to be called %d times." , i , postBindPlugin . numPostBindCalled )
1159
1159
}
1160
1160
} else {
1161
1161
if test .prebindReject {
1162
1162
if err = waitForPodUnschedulable (cs , pod ); err != nil {
1163
1163
t .Errorf ("test #%v: Didn't expected the pod to be scheduled. error: %v" , i , err )
1164
1164
}
1165
- if postbindPlugin . numPostbindCalled > 0 {
1166
- t .Errorf ("test #%v: Didn't expected the postbind plugin to be called %d times." , i , postbindPlugin . numPostbindCalled )
1165
+ if postBindPlugin . numPostBindCalled > 0 {
1166
+ t .Errorf ("test #%v: Didn't expected the postbind plugin to be called %d times." , i , postBindPlugin . numPostBindCalled )
1167
1167
}
1168
1168
} else {
1169
1169
if err = waitForPodToSchedule (cs , pod ); err != nil {
1170
1170
t .Errorf ("test #%v: Expected the pod to be scheduled. error: %v" , i , err )
1171
1171
}
1172
- if postbindPlugin . numPostbindCalled == 0 {
1173
- t .Errorf ("test #%v: Expected the postbind plugin to be called, was called %d times." , i , postbindPlugin . numPostbindCalled )
1172
+ if postBindPlugin . numPostBindCalled == 0 {
1173
+ t .Errorf ("test #%v: Expected the postbind plugin to be called, was called %d times." , i , postBindPlugin . numPostBindCalled )
1174
1174
}
1175
1175
}
1176
1176
}
1177
1177
1178
- postbindPlugin .reset ()
1178
+ postBindPlugin .reset ()
1179
1179
prebindPlugin .reset ()
1180
1180
cleanupPods (cs , t , []* v1.Pod {pod })
1181
1181
}
0 commit comments