Add error handling for Register() call

Register() can return an error as [1], so this adds the error handling.

[1]: f772c9017c/pkg/scheduler/framework/v1alpha1/registry.go (L56)
This commit is contained in:
Kenichi Omichi 2019-12-30 23:35:26 +00:00
parent a1364be012
commit 43d9748d3a

View File

@ -125,9 +125,12 @@ func TestPreemption(t *testing.T) {
// Initialize scheduler with a filter plugin.
var filter tokenFilter
registry := make(framework.Registry)
registry.Register(filterPluginName, func(_ *runtime.Unknown, fh framework.FrameworkHandle) (framework.Plugin, error) {
err := registry.Register(filterPluginName, func(_ *runtime.Unknown, fh framework.FrameworkHandle) (framework.Plugin, error) {
return &filter, nil
})
if err != nil {
t.Fatalf("Error registering a filter: %v", err)
}
plugins := &schedulerconfig.Plugins{
Filter: &schedulerconfig.PluginSet{
Enabled: []schedulerconfig.Plugin{