Plugins: Core plugins register via backend factory provider (#43171)

* refactoring store interface and init flow

* fix import

* fix linter

* refactor resource calling

* load with class

* re-order args

* fix tests

* fix linter

* remove old creator

* add custom config struct

* fix some tests

* cleanup

* fix

* tackle plugins

* fix linter

* refactor and fix test

* add connect failure error

* add fix for azure, cloud monitoring and test data

* restructure

* remove unused err

* add fake tracer for test

* fix grafana ds plugin
This commit is contained in:
Will Browne
2022-01-20 18:16:22 +01:00
committed by GitHub
parent 2fd76ecaf7
commit 7fbc7d019a
30 changed files with 326 additions and 380 deletions
@@ -91,7 +91,7 @@ func (s *fakeProxy) Do(rw http.ResponseWriter, req *http.Request, cli *http.Clie
return nil
}
func Test_resourceHandler(t *testing.T) {
func Test_handleResourceReq(t *testing.T) {
proxy := &fakeProxy{}
s := Service{
im: &fakeInstance{
@@ -102,7 +102,6 @@ func Test_resourceHandler(t *testing.T) {
},
},
},
Cfg: &setting.Cfg{},
executors: map[string]azDatasourceExecutor{
azureMonitor: &AzureMonitorDatasource{
proxy: proxy,
@@ -114,7 +113,7 @@ func Test_resourceHandler(t *testing.T) {
if err != nil {
t.Fatalf("Unexpected error %v", err)
}
s.resourceHandler(azureMonitor)(rw, req)
s.handleResourceReq(azureMonitor)(rw, req)
expectedURL := "https://management.azure.com/subscriptions/44693801"
if proxy.requestedURL != expectedURL {
t.Errorf("Unexpected result URL. Got %s, expecting %s", proxy.requestedURL, expectedURL)