mirror of
https://github.com/grafana/grafana.git
synced 2024-12-28 18:01:40 -06:00
Plugins: Fix plugin registered startup log line (#54634)
* fix plugin registered log * remove stale test
This commit is contained in:
parent
11689c0385
commit
43987e7f8c
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user