mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 20:24:18 -06:00
72da44db0e
* first pass * change validation signature * err tracking * fix * undo golden * 1 more * fix * adjust doc * add test helper * fix linter
39 lines
944 B
Go
39 lines
944 B
Go
package loader
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/grafana/grafana/pkg/plugins"
|
|
)
|
|
|
|
type fakeSignatureErrorTracker struct {
|
|
RecordFunc func(ctx context.Context, err *plugins.SignatureError)
|
|
ClearFunc func(ctx context.Context, pluginID string)
|
|
SignatureErrorsFunc func(ctx context.Context) []*plugins.SignatureError
|
|
}
|
|
|
|
func newFakeSignatureErrorTracker() *fakeSignatureErrorTracker {
|
|
return &fakeSignatureErrorTracker{}
|
|
}
|
|
|
|
func (t *fakeSignatureErrorTracker) Record(ctx context.Context, err *plugins.SignatureError) {
|
|
if t.RecordFunc != nil {
|
|
t.RecordFunc(ctx, err)
|
|
return
|
|
}
|
|
}
|
|
|
|
func (t *fakeSignatureErrorTracker) Clear(ctx context.Context, pluginID string) {
|
|
if t.ClearFunc != nil {
|
|
t.ClearFunc(ctx, pluginID)
|
|
return
|
|
}
|
|
}
|
|
|
|
func (t *fakeSignatureErrorTracker) SignatureErrors(ctx context.Context) []*plugins.SignatureError {
|
|
if t.SignatureErrorsFunc != nil {
|
|
return t.SignatureErrorsFunc(ctx)
|
|
}
|
|
return nil
|
|
}
|