Plugins: Fix plugin registered startup log line (#54634)

* fix plugin registered log

* remove stale test
This commit is contained in:
Will Browne 2022-09-02 14:01:52 +02:00 committed by GitHub
parent 11689c0385
commit 43987e7f8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 24 deletions

View File

@ -211,6 +211,11 @@ func (m *PluginManager) registerAndStart(ctx context.Context, p *plugins.Plugin)
if err := m.pluginRegistry.Add(ctx, p); err != nil {
return err
}
if !p.IsCorePlugin() {
m.log.Info("Plugin registered", "pluginID", p.ID)
}
return m.processManager.Start(ctx, p.ID)
}

View File

@ -48,11 +48,6 @@ func (m *Manager) Start(ctx context.Context, pluginID string) error {
return nil
}
if p.IsCorePlugin() {
return nil
}
m.log.Info("Plugin registered", "pluginID", p.ID)
m.mu.Lock()
defer m.mu.Unlock()
@ -106,6 +101,10 @@ func startPluginAndRestartKilledProcesses(ctx context.Context, p *plugins.Plugin
return err
}
if p.IsCorePlugin() {
return nil
}
go func(ctx context.Context, p *plugins.Plugin) {
if err := restartKilledProcess(ctx, p); err != nil {
p.Logger().Error("Attempt to restart killed plugin process failed", "error", err)

View File

@ -18,25 +18,6 @@ func TestProcessManager_Start(t *testing.T) {
require.ErrorIs(t, err, backendplugin.ErrPluginNotRegistered)
})
t.Run("Cannot start a core plugin", func(t *testing.T) {
pluginID := "core-datasource"
bp := newFakeBackendPlugin(true)
p := createPlugin(t, bp, func(plugin *plugins.Plugin) {
plugin.ID = pluginID
plugin.Class = plugins.Core
plugin.Backend = true
})
m := NewManager(newFakePluginRegistry(map[string]*plugins.Plugin{
pluginID: p,
}))
err := m.Start(context.Background(), pluginID)
require.NoError(t, err)
require.True(t, p.Exited())
require.Zero(t, bp.startCount)
})
t.Run("Plugin state determines process start", func(t *testing.T) {
tcs := []struct {
name string