From f7e12e5f93ffeab58bbe1f0d627c4709d1b35d55 Mon Sep 17 00:00:00 2001 From: bergquist Date: Thu, 24 Nov 2016 09:05:02 +0100 Subject: [PATCH] test(cloudwatch): fixes failing tests --- pkg/api/cloudwatch/metrics_test.go | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/pkg/api/cloudwatch/metrics_test.go b/pkg/api/cloudwatch/metrics_test.go index 6dd68037613..1595114329a 100644 --- a/pkg/api/cloudwatch/metrics_test.go +++ b/pkg/api/cloudwatch/metrics_test.go @@ -11,11 +11,13 @@ import ( func TestCloudWatchMetrics(t *testing.T) { Convey("When calling getMetricsForCustomMetrics", t, func() { - region := "us-east-1" - namespace := "Foo" - database := "default" - assumeRoleArn := "" - f := func(region string, namespace string, database string, assumeRoleArn string) (cloudwatch.ListMetricsOutput, error) { + dsInfo := &CloudwatchDatasource{ + Region: "us-east-1", + Namespace: "Foo", + Profile: "default", + AssumeRoleArn: "", + } + f := func(dsInfo *CloudwatchDatasource) (cloudwatch.ListMetricsOutput, error) { return cloudwatch.ListMetricsOutput{ Metrics: []*cloudwatch.Metric{ { @@ -29,7 +31,7 @@ func TestCloudWatchMetrics(t *testing.T) { }, }, nil } - metrics, _ := getMetricsForCustomMetrics(region, namespace, database, assumeRoleArn, f) + metrics, _ := getMetricsForCustomMetrics(dsInfo, f) Convey("Should contain Test_MetricName", func() { So(metrics, ShouldContain, "Test_MetricName") @@ -37,11 +39,13 @@ func TestCloudWatchMetrics(t *testing.T) { }) Convey("When calling getDimensionsForCustomMetrics", t, func() { - region := "us-east-1" - namespace := "Foo" - database := "default" - assumeRoleArn := "" - f := func(region string, namespace string, database string, assumeRoleArn string) (cloudwatch.ListMetricsOutput, error) { + dsInfo := &CloudwatchDatasource{ + Region: "us-east-1", + Namespace: "Foo", + Profile: "default", + AssumeRoleArn: "", + } + f := func(dsInfo *CloudwatchDatasource) (cloudwatch.ListMetricsOutput, error) { return cloudwatch.ListMetricsOutput{ Metrics: []*cloudwatch.Metric{ { @@ -55,7 +59,7 @@ func TestCloudWatchMetrics(t *testing.T) { }, }, nil } - dimensionKeys, _ := getDimensionsForCustomMetrics(region, namespace, database, assumeRoleArn, f) + dimensionKeys, _ := getDimensionsForCustomMetrics(dsInfo, f) Convey("Should contain Test_DimensionName", func() { So(dimensionKeys, ShouldContain, "Test_DimensionName")