[v9.0.x] Chore: Remove global bus variable (#51126)

* Chore: Remove global bus variable (#50765)

* Chore: Remove global bus variable

* fix bus in tests

(cherry picked from commit 0b55c41d05)

* fix the imports
This commit is contained in:
Serge Zaitsev
2022-06-21 11:40:44 +02:00
committed by GitHub
parent 8522e2248c
commit 72c6512e3f
15 changed files with 69 additions and 92 deletions
+2 -3
View File
@@ -11,7 +11,6 @@ import (
"testing"
"time"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/events"
"github.com/grafana/grafana/pkg/models"
ac "github.com/grafana/grafana/pkg/services/accesscontrol"
@@ -99,7 +98,7 @@ func TestIntegrationDataAccess(t *testing.T) {
sqlStore := InitTestDB(t)
var created *events.DataSourceCreated
bus.AddEventListener(func(ctx context.Context, e *events.DataSourceCreated) error {
sqlStore.bus.AddEventListener(func(ctx context.Context, e *events.DataSourceCreated) error {
created = e
return nil
})
@@ -245,7 +244,7 @@ func TestIntegrationDataAccess(t *testing.T) {
ds := initDatasource(sqlStore)
var deleted *events.DataSourceDeleted
bus.AddEventListener(func(ctx context.Context, e *events.DataSourceDeleted) error {
sqlStore.bus.AddEventListener(func(ctx context.Context, e *events.DataSourceDeleted) error {
deleted = e
return nil
})