mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Soft failure in plugin initialization (#66210)
This commit is contained in:
committed by
GitHub
parent
48de17945f
commit
52f39e6fa0
@@ -299,23 +299,28 @@ func (m *FakeProcessManager) Stop(ctx context.Context, pluginID string) error {
|
||||
}
|
||||
|
||||
type FakeBackendProcessProvider struct {
|
||||
Requested map[string]int
|
||||
Invoked map[string]int
|
||||
Requested map[string]int
|
||||
Invoked map[string]int
|
||||
BackendFactoryFunc func(context.Context, *plugins.Plugin) backendplugin.PluginFactoryFunc
|
||||
}
|
||||
|
||||
func NewFakeBackendProcessProvider() *FakeBackendProcessProvider {
|
||||
return &FakeBackendProcessProvider{
|
||||
f := &FakeBackendProcessProvider{
|
||||
Requested: make(map[string]int),
|
||||
Invoked: make(map[string]int),
|
||||
}
|
||||
f.BackendFactoryFunc = func(ctx context.Context, p *plugins.Plugin) backendplugin.PluginFactoryFunc {
|
||||
f.Requested[p.ID]++
|
||||
return func(pluginID string, _ log.Logger, _ []string) (backendplugin.Plugin, error) {
|
||||
f.Invoked[pluginID]++
|
||||
return &FakePluginClient{}, nil
|
||||
}
|
||||
}
|
||||
return f
|
||||
}
|
||||
|
||||
func (pr *FakeBackendProcessProvider) BackendFactory(_ context.Context, p *plugins.Plugin) backendplugin.PluginFactoryFunc {
|
||||
pr.Requested[p.ID]++
|
||||
return func(pluginID string, _ log.Logger, _ []string) (backendplugin.Plugin, error) {
|
||||
pr.Invoked[pluginID]++
|
||||
return &FakePluginClient{}, nil
|
||||
}
|
||||
func (pr *FakeBackendProcessProvider) BackendFactory(ctx context.Context, p *plugins.Plugin) backendplugin.PluginFactoryFunc {
|
||||
return pr.BackendFactoryFunc(ctx, p)
|
||||
}
|
||||
|
||||
type FakeLicensingService struct {
|
||||
|
||||
Reference in New Issue
Block a user