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
@@ -5,7 +5,6 @@ import (
"testing"
"time"
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/models"
"github.com/stretchr/testify/require"
)
@@ -86,7 +85,7 @@ func TestIntegrationPluginSettings(t *testing.T) {
t.Run("UpdatePluginSetting should update existing plugin settings and publish PluginStateChangedEvent", func(t *testing.T) {
var pluginStateChangedEvent *models.PluginStateChangedEvent
bus.AddEventListener(func(_ context.Context, evt *models.PluginStateChangedEvent) error {
store.bus.AddEventListener(func(_ context.Context, evt *models.PluginStateChangedEvent) error {
pluginStateChangedEvent = evt
return nil
})
@@ -145,7 +144,7 @@ func TestIntegrationPluginSettings(t *testing.T) {
t.Run("Non-existing plugin settings", func(t *testing.T) {
t.Run("UpdatePluginSetting should insert plugin settings and publish PluginStateChangedEvent", func(t *testing.T) {
var pluginStateChangedEvent *models.PluginStateChangedEvent
bus.AddEventListener(func(_ context.Context, evt *models.PluginStateChangedEvent) error {
store.bus.AddEventListener(func(_ context.Context, evt *models.PluginStateChangedEvent) error {
pluginStateChangedEvent = evt
return nil
})