Chore: Remove global bus variable (#50765)

* Chore: Remove global bus variable

* fix bus in tests
This commit is contained in:
Serge Zaitsev
2022-06-14 16:07:41 +02:00
committed by GitHub
parent 99c8ce5ab9
commit 0b55c41d05
15 changed files with 68 additions and 92 deletions
+2 -3
View File
@@ -8,7 +8,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
})