CloudWatch: Remove dependencies on grafana/pkg/setting (#81208)
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
func TestMetricDataQueryBuilder(t *testing.T) {
|
||||
t.Run("buildMetricDataQuery", func(t *testing.T) {
|
||||
t.Run("should use metric stat", func(t *testing.T) {
|
||||
executor := newExecutor(nil, newTestConfig(), &fakeSessionCache{})
|
||||
executor := newExecutor(nil, &fakeSessionCache{})
|
||||
query := getBaseQuery()
|
||||
query.MetricEditorMode = models.MetricEditorModeBuilder
|
||||
query.MetricQueryType = models.MetricQueryTypeSearch
|
||||
@@ -24,7 +24,7 @@ func TestMetricDataQueryBuilder(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should pass AccountId in metric stat query", func(t *testing.T) {
|
||||
executor := newExecutor(nil, newTestConfig(), &fakeSessionCache{})
|
||||
executor := newExecutor(nil, &fakeSessionCache{})
|
||||
query := getBaseQuery()
|
||||
query.MetricEditorMode = models.MetricEditorModeBuilder
|
||||
query.MetricQueryType = models.MetricQueryTypeSearch
|
||||
@@ -35,7 +35,7 @@ func TestMetricDataQueryBuilder(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should leave AccountId in metric stat query", func(t *testing.T) {
|
||||
executor := newExecutor(nil, newTestConfig(), &fakeSessionCache{})
|
||||
executor := newExecutor(nil, &fakeSessionCache{})
|
||||
query := getBaseQuery()
|
||||
query.MetricEditorMode = models.MetricEditorModeBuilder
|
||||
query.MetricQueryType = models.MetricQueryTypeSearch
|
||||
@@ -45,7 +45,7 @@ func TestMetricDataQueryBuilder(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should use custom built expression", func(t *testing.T) {
|
||||
executor := newExecutor(nil, newTestConfig(), &fakeSessionCache{})
|
||||
executor := newExecutor(nil, &fakeSessionCache{})
|
||||
query := getBaseQuery()
|
||||
query.MetricEditorMode = models.MetricEditorModeBuilder
|
||||
query.MetricQueryType = models.MetricQueryTypeSearch
|
||||
@@ -57,7 +57,7 @@ func TestMetricDataQueryBuilder(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should use sql expression", func(t *testing.T) {
|
||||
executor := newExecutor(nil, newTestConfig(), &fakeSessionCache{})
|
||||
executor := newExecutor(nil, &fakeSessionCache{})
|
||||
query := getBaseQuery()
|
||||
query.MetricEditorMode = models.MetricEditorModeRaw
|
||||
query.MetricQueryType = models.MetricQueryTypeQuery
|
||||
@@ -69,7 +69,7 @@ func TestMetricDataQueryBuilder(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should use user defined math expression", func(t *testing.T) {
|
||||
executor := newExecutor(nil, newTestConfig(), &fakeSessionCache{})
|
||||
executor := newExecutor(nil, &fakeSessionCache{})
|
||||
query := getBaseQuery()
|
||||
query.MetricEditorMode = models.MetricEditorModeRaw
|
||||
query.MetricQueryType = models.MetricQueryTypeSearch
|
||||
@@ -81,7 +81,7 @@ func TestMetricDataQueryBuilder(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should set period in user defined expression", func(t *testing.T) {
|
||||
executor := newExecutor(nil, newTestConfig(), &fakeSessionCache{})
|
||||
executor := newExecutor(nil, &fakeSessionCache{})
|
||||
query := getBaseQuery()
|
||||
query.MetricEditorMode = models.MetricEditorModeRaw
|
||||
query.MetricQueryType = models.MetricQueryTypeSearch
|
||||
@@ -95,7 +95,7 @@ func TestMetricDataQueryBuilder(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should set label", func(t *testing.T) {
|
||||
executor := newExecutor(nil, newTestConfig(), &fakeSessionCache{})
|
||||
executor := newExecutor(nil, &fakeSessionCache{})
|
||||
query := getBaseQuery()
|
||||
query.Label = "some label"
|
||||
|
||||
@@ -107,7 +107,7 @@ func TestMetricDataQueryBuilder(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should not set label for empty string query label", func(t *testing.T) {
|
||||
executor := newExecutor(nil, newTestConfig(), &fakeSessionCache{})
|
||||
executor := newExecutor(nil, &fakeSessionCache{})
|
||||
query := getBaseQuery()
|
||||
query.Label = ""
|
||||
|
||||
@@ -118,7 +118,7 @@ func TestMetricDataQueryBuilder(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run(`should not specify accountId when it is "all"`, func(t *testing.T) {
|
||||
executor := newExecutor(nil, newTestConfig(), &fakeSessionCache{})
|
||||
executor := newExecutor(nil, &fakeSessionCache{})
|
||||
query := &models.CloudWatchQuery{
|
||||
Namespace: "AWS/EC2",
|
||||
MetricName: "CPUUtilization",
|
||||
@@ -136,7 +136,7 @@ func TestMetricDataQueryBuilder(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should set accountId when it is specified", func(t *testing.T) {
|
||||
executor := newExecutor(nil, newTestConfig(), &fakeSessionCache{})
|
||||
executor := newExecutor(nil, &fakeSessionCache{})
|
||||
query := &models.CloudWatchQuery{
|
||||
Namespace: "AWS/EC2",
|
||||
MetricName: "CPUUtilization",
|
||||
|
||||
Reference in New Issue
Block a user