mirror of
https://github.com/grafana/grafana.git
synced 2025-02-16 18:34:52 -06:00
* Add integration with Jeager Add Jaeger datasource and modify derived fields in loki to allow for opening a trace in Jager in separate split. Modifies build so that this branch docker images are pushed to docker hub Add a traceui dir with docker-compose and provision files for demoing.:wq * Enable docker logger plugin to send logs to loki * Add placeholder zipkin datasource * Fixed rebase issues, added enhanceDataFrame to non-legacy code path * Trace selector for jaeger query field * Fix logs default mode for Loki * Fix loading jaeger query field services on split * Updated grafana image in traceui/compose file * Fix prettier error * Hide behind feature flag, clean up unused code. * Fix tests * Fix tests * Cleanup code and review feedback * Remove traceui directory * Remove circle build changes * Fix feature toggles object * Fix merge issues * Fix some null errors * Fix test after strict null changes * Review feedback fixes * Fix toggle name Co-authored-by: David Kaltschmidt <david.kaltschmidt@gmail.com>
71 lines
1.8 KiB
Go
71 lines
1.8 KiB
Go
package plugins
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/grafana/grafana/pkg/bus"
|
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
|
"github.com/grafana/grafana/pkg/models"
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
"gopkg.in/ini.v1"
|
|
)
|
|
|
|
func TestPluginDashboards(t *testing.T) {
|
|
Convey("When asking plugin dashboard info", t, func() {
|
|
setting.Raw = ini.Empty()
|
|
sec, _ := setting.Raw.NewSection("plugin.test-app")
|
|
_, err := sec.NewKey("path", "testdata/test-app")
|
|
So(err, ShouldBeNil)
|
|
|
|
pm := &PluginManager{
|
|
Cfg: &setting.Cfg{
|
|
FeatureToggles: map[string]bool{},
|
|
},
|
|
}
|
|
err = pm.Init()
|
|
So(err, ShouldBeNil)
|
|
|
|
bus.AddHandler("test", func(query *models.GetDashboardQuery) error {
|
|
if query.Slug == "nginx-connections" {
|
|
dash := models.NewDashboard("Nginx Connections")
|
|
dash.Data.Set("revision", "1.1")
|
|
query.Result = dash
|
|
return nil
|
|
}
|
|
|
|
return models.ErrDashboardNotFound
|
|
})
|
|
|
|
bus.AddHandler("test", func(query *models.GetDashboardsByPluginIdQuery) error {
|
|
var data = simplejson.New()
|
|
data.Set("title", "Nginx Connections")
|
|
data.Set("revision", 22)
|
|
|
|
query.Result = []*models.Dashboard{
|
|
{Slug: "nginx-connections", Data: data},
|
|
}
|
|
return nil
|
|
})
|
|
|
|
dashboards, err := GetPluginDashboards(1, "test-app")
|
|
|
|
So(err, ShouldBeNil)
|
|
|
|
Convey("should return 2 dashboarrd", func() {
|
|
So(len(dashboards), ShouldEqual, 2)
|
|
})
|
|
|
|
Convey("should include installed version info", func() {
|
|
So(dashboards[0].Title, ShouldEqual, "Nginx Connections")
|
|
So(dashboards[0].Revision, ShouldEqual, 25)
|
|
So(dashboards[0].ImportedRevision, ShouldEqual, 22)
|
|
So(dashboards[0].ImportedUri, ShouldEqual, "db/nginx-connections")
|
|
|
|
So(dashboards[1].Revision, ShouldEqual, 2)
|
|
So(dashboards[1].ImportedRevision, ShouldEqual, 0)
|
|
})
|
|
})
|
|
|
|
}
|