mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugins: Add Plugin FS abstraction (#63734)
* unexport pluginDir from dto * first pass * tidy * naming + add mutex * add dupe checking * fix func typo * interface + move logic from renderer * remote finder * remote signing * fix tests * tidy up * tidy markdown logic * split changes * fix tests * slim interface down * fix status code * tidy exec path func * fixup * undo changes * remove unused func * remove unused func * fix goimports * fetch remotely * simultaneous support * fix linter * use var * add exception for gosec warning * fixup * fix tests * tidy * rework cfg pattern * simplify * PR feedback * fix dupe field * remove g304 nolint * apply PR feedback * remove unnecessary gosec nolint * fix finder loop and update comment * fix map alloc * fix test * remove commented code
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"archive/zip"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"sync"
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
@@ -351,6 +352,30 @@ func (f *FakeRoleRegistry) DeclarePluginRoles(_ context.Context, _ string, _ str
|
||||
return f.ExpectedErr
|
||||
}
|
||||
|
||||
type FakePluginFiles struct {
|
||||
FS fs.FS
|
||||
|
||||
base string
|
||||
}
|
||||
|
||||
func NewFakePluginFiles(base string) *FakePluginFiles {
|
||||
return &FakePluginFiles{
|
||||
base: base,
|
||||
}
|
||||
}
|
||||
|
||||
func (f *FakePluginFiles) Open(name string) (fs.File, error) {
|
||||
return f.FS.Open(name)
|
||||
}
|
||||
|
||||
func (f *FakePluginFiles) Base() string {
|
||||
return f.base
|
||||
}
|
||||
|
||||
func (f *FakePluginFiles) Files() []string {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
type FakeSources struct {
|
||||
ListFunc func(_ context.Context) []plugins.PluginSource
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user