CloudWatch: Refactor to extract DataQuery grouping by region out of request parsing (#57392)

* CloudWatch: Extract request parsing grouping by region from ParseQueries

* Rename ParseQueries to ParseMetricDataQueries
This commit is contained in:
Shirley
2022-10-24 14:57:32 +02:00
committed by GitHub
parent 1bda67ab11
commit 9ebed91eed
5 changed files with 169 additions and 11 deletions
+10
View File
@@ -17,6 +17,7 @@ import (
"github.com/grafana/grafana-aws-sdk/pkg/awsds"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana/pkg/setting"
"github.com/stretchr/testify/mock"
)
type fakeCWLogsClient struct {
@@ -190,6 +191,15 @@ func newTestConfig() *setting.Cfg {
return &setting.Cfg{AWSAllowedAuthProviders: []string{"default"}, AWSAssumeRoleEnabled: true, AWSListMetricsPageLimit: 1000}
}
type mockSessionCache struct {
mock.Mock
}
func (c *mockSessionCache) GetSession(config awsds.SessionConfig) (*session.Session, error) {
args := c.Called(config)
return args.Get(0).(*session.Session), args.Error(1)
}
type fakeSessionCache struct {
getSession func(c awsds.SessionConfig) (*session.Session, error)
calledRegions []string