mirror of
https://github.com/grafana/grafana.git
synced 2026-08-13 06:34:55 -05:00
Plugins: Make Installer responsible for removing plugins from file system (#73323)
* installer is responsible for removing from file system * take plugin as arg * remove resolve step * return plugin in test
This commit is contained in:
@@ -40,7 +40,7 @@ func (i *FakePluginInstaller) Remove(ctx context.Context, pluginID string) error
|
||||
|
||||
type FakeLoader struct {
|
||||
LoadFunc func(_ context.Context, _ plugins.PluginSource) ([]*plugins.Plugin, error)
|
||||
UnloadFunc func(_ context.Context, _ string) error
|
||||
UnloadFunc func(_ context.Context, _ *plugins.Plugin) (*plugins.Plugin, error)
|
||||
}
|
||||
|
||||
func (l *FakeLoader) Load(ctx context.Context, src plugins.PluginSource) ([]*plugins.Plugin, error) {
|
||||
@@ -50,11 +50,11 @@ func (l *FakeLoader) Load(ctx context.Context, src plugins.PluginSource) ([]*plu
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (l *FakeLoader) Unload(ctx context.Context, pluginID string) error {
|
||||
func (l *FakeLoader) Unload(ctx context.Context, p *plugins.Plugin) (*plugins.Plugin, error) {
|
||||
if l.UnloadFunc != nil {
|
||||
return l.UnloadFunc(ctx, pluginID)
|
||||
return l.UnloadFunc(ctx, p)
|
||||
}
|
||||
return nil
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
type FakePluginClient struct {
|
||||
@@ -509,14 +509,14 @@ func (f *FakeInitializer) Initialize(ctx context.Context, ps []*plugins.Plugin)
|
||||
}
|
||||
|
||||
type FakeTerminator struct {
|
||||
TerminateFunc func(ctx context.Context, pluginID string) error
|
||||
TerminateFunc func(ctx context.Context, p *plugins.Plugin) (*plugins.Plugin, error)
|
||||
}
|
||||
|
||||
func (f *FakeTerminator) Terminate(ctx context.Context, pluginID string) error {
|
||||
func (f *FakeTerminator) Terminate(ctx context.Context, p *plugins.Plugin) (*plugins.Plugin, error) {
|
||||
if f.TerminateFunc != nil {
|
||||
return f.TerminateFunc(ctx, pluginID)
|
||||
return f.TerminateFunc(ctx, p)
|
||||
}
|
||||
return nil
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
type FakeBackendPlugin struct {
|
||||
|
||||
Reference in New Issue
Block a user