From dc2a9e19e2fd4a34abcf12fa399ab5d3fbd9e623 Mon Sep 17 00:00:00 2001 From: Guilherme Caulada Date: Tue, 5 Apr 2022 16:31:49 -0300 Subject: [PATCH] Fix metrics api tests --- pkg/api/metrics_test.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/api/metrics_test.go b/pkg/api/metrics_test.go index 634ce0ee74e..faa7631c523 100644 --- a/pkg/api/metrics_test.go +++ b/pkg/api/metrics_test.go @@ -8,6 +8,8 @@ import ( "strings" "testing" + "github.com/grafana/grafana/pkg/bus" + acmock "github.com/grafana/grafana/pkg/services/accesscontrol/mock" "github.com/grafana/grafana/pkg/services/featuremgmt" "github.com/grafana/grafana/pkg/services/sqlstore/mockstore" @@ -17,8 +19,9 @@ import ( "github.com/grafana/grafana/pkg/components/simplejson" "github.com/grafana/grafana/pkg/models" "github.com/grafana/grafana/pkg/plugins" + datasources "github.com/grafana/grafana/pkg/services/datasources/service" "github.com/grafana/grafana/pkg/services/query" - "github.com/grafana/grafana/pkg/services/secrets/fakes" + "github.com/grafana/grafana/pkg/services/secrets/kvstore" "github.com/stretchr/testify/assert" ) @@ -192,13 +195,16 @@ type dashboardFakePluginClient struct { func TestAPIEndpoint_Metrics_QueryMetricsFromDashboard(t *testing.T) { sc := setupHTTPServerWithMockDb(t, false, false) + ss := kvstore.SetupTestService(t) + ds := datasources.ProvideService(bus.New(), nil, ss, nil, featuremgmt.WithFeatures(), acmock.New(), acmock.NewPermissionsServicesMock()) + setInitCtxSignedInViewer(sc.initCtx) sc.hs.queryDataService = query.ProvideService( nil, nil, nil, &fakePluginRequestValidator{}, - fakes.NewFakeSecretsService(), + ds, &dashboardFakePluginClient{}, &fakeOAuthTokenService{}, )