CloudWatch: Add tests to query input region in executeLogAlertQuery (#46212)

This commit is contained in:
Shirley
2022-03-04 11:15:36 +01:00
committed by GitHub
parent bdbb9ed54a
commit 438512c7ef
7 changed files with 104 additions and 36 deletions
+5 -2
View File
@@ -217,10 +217,13 @@ func newTestConfig() *setting.Cfg {
}
type fakeSessionCache struct {
getSession func(c awsds.SessionConfig) (*session.Session, error)
getSession func(c awsds.SessionConfig) (*session.Session, error)
calledRegions []string
}
func (s fakeSessionCache) GetSession(c awsds.SessionConfig) (*session.Session, error) {
func (s *fakeSessionCache) GetSession(c awsds.SessionConfig) (*session.Session, error) {
s.calledRegions = append(s.calledRegions, c.Settings.Region)
if s.getSession != nil {
return s.getSession(c)
}