|
@@ -5,19 +5,20 @@ import (
|
|
|
|
|
|
|
|
"github.com/aws/aws-sdk-go/aws"
|
|
"github.com/aws/aws-sdk-go/aws"
|
|
|
"github.com/aws/aws-sdk-go/service/cloudwatch"
|
|
"github.com/aws/aws-sdk-go/service/cloudwatch"
|
|
|
|
|
+ cwapi "github.com/grafana/grafana/pkg/api/cloudwatch"
|
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
func TestCloudWatchMetrics(t *testing.T) {
|
|
func TestCloudWatchMetrics(t *testing.T) {
|
|
|
|
|
|
|
|
Convey("When calling getMetricsForCustomMetrics", t, func() {
|
|
Convey("When calling getMetricsForCustomMetrics", t, func() {
|
|
|
- dsInfo := &DatasourceInfo{
|
|
|
|
|
|
|
+ dsInfo := &cwapi.DatasourceInfo{
|
|
|
Region: "us-east-1",
|
|
Region: "us-east-1",
|
|
|
Namespace: "Foo",
|
|
Namespace: "Foo",
|
|
|
Profile: "default",
|
|
Profile: "default",
|
|
|
AssumeRoleArn: "",
|
|
AssumeRoleArn: "",
|
|
|
}
|
|
}
|
|
|
- f := func(dsInfo *DatasourceInfo) (cloudwatch.ListMetricsOutput, error) {
|
|
|
|
|
|
|
+ f := func(dsInfo *cwapi.DatasourceInfo) (cloudwatch.ListMetricsOutput, error) {
|
|
|
return cloudwatch.ListMetricsOutput{
|
|
return cloudwatch.ListMetricsOutput{
|
|
|
Metrics: []*cloudwatch.Metric{
|
|
Metrics: []*cloudwatch.Metric{
|
|
|
{
|
|
{
|
|
@@ -39,13 +40,13 @@ func TestCloudWatchMetrics(t *testing.T) {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
Convey("When calling getDimensionsForCustomMetrics", t, func() {
|
|
Convey("When calling getDimensionsForCustomMetrics", t, func() {
|
|
|
- dsInfo := &DatasourceInfo{
|
|
|
|
|
|
|
+ dsInfo := &cwapi.DatasourceInfo{
|
|
|
Region: "us-east-1",
|
|
Region: "us-east-1",
|
|
|
Namespace: "Foo",
|
|
Namespace: "Foo",
|
|
|
Profile: "default",
|
|
Profile: "default",
|
|
|
AssumeRoleArn: "",
|
|
AssumeRoleArn: "",
|
|
|
}
|
|
}
|
|
|
- f := func(dsInfo *DatasourceInfo) (cloudwatch.ListMetricsOutput, error) {
|
|
|
|
|
|
|
+ f := func(dsInfo *cwapi.DatasourceInfo) (cloudwatch.ListMetricsOutput, error) {
|
|
|
return cloudwatch.ListMetricsOutput{
|
|
return cloudwatch.ListMetricsOutput{
|
|
|
Metrics: []*cloudwatch.Metric{
|
|
Metrics: []*cloudwatch.Metric{
|
|
|
{
|
|
{
|