Plugins: Set grafana config, plugin version and user agent on plugin requests (#75171)

* first pass

* fixup

* remove test line

* fix tests

* use new fields

* fix imports + formatting

* fix tests

* rollback changes

* undo whitespace

* apply pr feedback
This commit is contained in:
Will Browne
2023-09-21 11:33:31 +02:00
committed by GitHub
parent dd8f88b194
commit 7fca1bde54
37 changed files with 248 additions and 102 deletions

View File

@@ -12,6 +12,8 @@ import (
"github.com/grafana/grafana/pkg/infra/localcache"
"github.com/grafana/grafana/pkg/infra/log"
"github.com/grafana/grafana/pkg/plugins"
"github.com/grafana/grafana/pkg/plugins/config"
pluginFakes "github.com/grafana/grafana/pkg/plugins/manager/fakes"
acmock "github.com/grafana/grafana/pkg/services/accesscontrol/mock"
"github.com/grafana/grafana/pkg/services/datasources"
datasourceservice "github.com/grafana/grafana/pkg/services/datasources/service"
@@ -43,9 +45,9 @@ func TestHandleRequest(t *testing.T) {
dsService, err := datasourceservice.ProvideService(nil, secretsService, secretsStore, sqlStore.Cfg, featuremgmt.WithFeatures(), acmock.New(), datasourcePermissions, quotaService)
require.NoError(t, err)
pCtxProvider := plugincontext.ProvideService(localcache.ProvideService(), &pluginstore.FakePluginStore{
pCtxProvider := plugincontext.ProvideService(sqlStore.Cfg, localcache.ProvideService(), &pluginstore.FakePluginStore{
PluginList: []pluginstore.Plugin{{JSONData: plugins.JSONData{ID: "test"}}},
}, dsService, pluginSettings.ProvideService(sqlStore, secretsService))
}, dsService, pluginSettings.ProvideService(sqlStore, secretsService), pluginFakes.NewFakeLicensingService(), &config.Cfg{})
s := ProvideService(client, nil, dsService, pCtxProvider)
ds := &datasources.DataSource{ID: 12, Type: "test", JsonData: simplejson.New()}