Shared Azure middleware between Azure Monitor and Prometheus datasources (#46002)

* Scopes in Azure middleware

* Enable Azure middleware without feature flag

* Use common Azure middleware in Azure Monitor

* Apply feature flag to JsonData configuration of Azure auth

* Enforce feature flag in Prometheus datasource

* Prometheus provider tests

* Datasource service tests

* Fix http client provider tests

* Pass sdkhttpclient.Options by reference

* Add middleware to httpclient.Options

* Remove dependency on Grafana settings

* Unit-tests updated

* Fix ds_proxy_test

* Fix service_test
This commit is contained in:
Sergey Kostrukov
2022-04-01 13:26:49 +02:00
committed by GitHub
parent 16db1ad46d
commit 656ade9884
39 changed files with 728 additions and 433 deletions
+8 -7
View File
@@ -3,6 +3,7 @@ package setting
import (
"testing"
"github.com/grafana/grafana/pkg/tsdb/azuremonitor/azsettings"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
@@ -17,27 +18,27 @@ func TestAzureSettings(t *testing.T) {
{
name: "should be Public if not set",
configuredValue: "",
resolvedValue: AzurePublic,
resolvedValue: azsettings.AzurePublic,
},
{
name: "should be Public if set to Public",
configuredValue: AzurePublic,
resolvedValue: AzurePublic,
configuredValue: azsettings.AzurePublic,
resolvedValue: azsettings.AzurePublic,
},
{
name: "should be Public if set to Public using alternative name",
configuredValue: "AzurePublicCloud",
resolvedValue: AzurePublic,
resolvedValue: azsettings.AzurePublic,
},
{
name: "should be China if set to China",
configuredValue: AzureChina,
resolvedValue: AzureChina,
configuredValue: azsettings.AzureChina,
resolvedValue: azsettings.AzureChina,
},
{
name: "should be US Government if set to US Government using alternative name",
configuredValue: "usgov",
resolvedValue: AzureUSGovernment,
resolvedValue: azsettings.AzureUSGovernment,
},
{
name: "should be same as set if not known",