Refactoring PluginManager to be a self registering service (#11755)

* refator: refactored PluginManager to be a self registering service, a lot more work needed to fully make plugin manager use instance variables and not so many globals
This commit is contained in:
Torkel Ödegaard
2018-04-27 15:11:55 +02:00
committed by Carl Bergquist
parent 8f29d28572
commit a8eed9d344
8 changed files with 64 additions and 74 deletions

View File

@ -1,7 +1,6 @@
package plugins
import (
"context"
"path/filepath"
"testing"
@ -15,7 +14,9 @@ func TestPluginScans(t *testing.T) {
Convey("When scanning for plugins", t, func() {
setting.StaticRootPath, _ = filepath.Abs("../../public/")
setting.Cfg = ini.Empty()
err := initPlugins(context.Background())
pm := &PluginManager{}
err := pm.Init()
So(err, ShouldBeNil)
So(len(DataSources), ShouldBeGreaterThan, 1)
@ -30,7 +31,9 @@ func TestPluginScans(t *testing.T) {
setting.Cfg = ini.Empty()
sec, _ := setting.Cfg.NewSection("plugin.nginx-app")
sec.NewKey("path", "../../tests/test-app")
err := initPlugins(context.Background())
pm := &PluginManager{}
err := pm.Init()
So(err, ShouldBeNil)
So(len(Apps), ShouldBeGreaterThan, 0)