Skip to content

Commit

Permalink
Fix: register remaining tasks without default (flyteorg#263)
Browse files Browse the repository at this point in the history
* Fix: register remaining tasks without default plugins

Signed-off-by: Filipe Regadas <[email protected]>

* Add test

Signed-off-by: Filipe Regadas <[email protected]>

* fixup! Add test

Signed-off-by: Filipe Regadas <[email protected]>
  • Loading branch information
regadas authored May 27, 2021
1 parent 78b35c2 commit f48fdff
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/controller/nodes/task/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ func (t *Handler) Setup(ctx context.Context, sCtx handler.SetupContext) error {
// Read from the fallback task handler map for any remaining tasks without a defaultPlugins registered handler.
for taskType, registeredPlugins := range fallbackTaskHandlerMap {
if _, ok := t.defaultPlugins[taskType]; ok {
break
continue
}
if len(registeredPlugins) != 1 {
logger.Errorf(ctx, "Multiple plugins registered to handle task type: %s. ([%+v])", taskType, registeredPlugins)
Expand Down
14 changes: 14 additions & 0 deletions pkg/controller/nodes/task/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,20 @@ func Test_task_Setup(t *testing.T) {
pluginIDs: map[pluginCore.TaskType]string{corePluginType: corePluginType, corePluginDefaultType: corePluginDefaultType, k8sPluginType: k8sPluginType, k8sPluginDefaultType: k8sPluginDefaultType},
defaultPluginID: corePluginDefaultType,
}, false},
{"partial-default-task-types",
testPluginRegistry{
core: []pluginCore.PluginEntry{corePluginEntry},
k8s: []pluginK8s.PluginEntry{k8sPluginEntry},
},
[]string{corePluginType, k8sPluginType},
map[string]string{corePluginType: corePluginType},
wantFields{
pluginIDs: map[pluginCore.TaskType]string{
corePluginType: corePluginType,
k8sPluginType: k8sPluginType,
},
},
false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit f48fdff

Please sign in to comment.