Chore: Remove global bus variable (#50765)
* Chore: Remove global bus variable * fix bus in tests
This commit is contained in:
@@ -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
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user