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
@@ -16,6 +16,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"
"github.com/grafana/grafana/pkg/plugins/manager/fakes"
"github.com/grafana/grafana/pkg/services/accesscontrol/acimpl"
"github.com/grafana/grafana/pkg/services/contexthandler/ctxkey"
contextmodel "github.com/grafana/grafana/pkg/services/contexthandler/model"
@@ -119,15 +121,17 @@ func buildQueryDataService(t *testing.T, cs datasources.CacheService, fpc *fakeP
}
ds := &fakeDatasources.FakeDataSourceService{}
pCtxProvider := plugincontext.ProvideService(localcache.ProvideService(), &pluginstore.FakePluginStore{
PluginList: []pluginstore.Plugin{
{
JSONData: plugins.JSONData{
ID: "mysql",
pCtxProvider := plugincontext.ProvideService(setting.NewCfg(),
localcache.ProvideService(), &pluginstore.FakePluginStore{
PluginList: []pluginstore.Plugin{
{
JSONData: plugins.JSONData{
ID: "mysql",
},
},
},
},
}, ds, pluginSettings.ProvideService(store, fakeSecrets.NewFakeSecretsService()))
}, ds, pluginSettings.ProvideService(store, fakeSecrets.NewFakeSecretsService()), fakes.NewFakeLicensingService(),
&config.Cfg{})
return query.ProvideService(
setting.NewCfg(),