plugins_test.go 846 B

1234567891011121314151617181920212223242526272829303132333435
  1. package plugins
  2. import (
  3. "path/filepath"
  4. "testing"
  5. "github.com/grafana/grafana/pkg/setting"
  6. . "github.com/smartystreets/goconvey/convey"
  7. "gopkg.in/ini.v1"
  8. )
  9. func TestPluginScans(t *testing.T) {
  10. Convey("When scaning for plugins", t, func() {
  11. setting.StaticRootPath, _ = filepath.Abs("../../public/")
  12. setting.Cfg = ini.Empty()
  13. err := Init()
  14. So(err, ShouldBeNil)
  15. So(len(DataSources), ShouldBeGreaterThan, 1)
  16. So(len(Panels), ShouldBeGreaterThan, 1)
  17. })
  18. Convey("When reading app plugin definition", t, func() {
  19. setting.Cfg = ini.Empty()
  20. sec, _ := setting.Cfg.NewSection("plugin.app-test")
  21. sec.NewKey("path", "../../tests/app-plugin-json")
  22. err := Init()
  23. So(err, ShouldBeNil)
  24. So(len(Apps), ShouldBeGreaterThan, 0)
  25. So(Apps["app-test"].Info.Logos.Large, ShouldEqual, "plugins/app-exampl/img/logo_large.png")
  26. })
  27. }