Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prometheus: Remove cache, pass headers in request, simplify client cr…
…eation for resource calls and custom client (#51436) * Remove cache, pass headers in request, simplify client creation * Add test for http options creation
- Loading branch information
Showing
17 changed files
with
238 additions
and
918 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package buffered | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/grafana/grafana-azure-sdk-go/azsettings" | ||
"github.com/grafana/grafana-plugin-sdk-go/backend" | ||
"github.com/grafana/grafana/pkg/infra/log/logtest" | ||
"github.com/grafana/grafana/pkg/services/featuremgmt" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestCreateTransportOptions(t *testing.T) { | ||
t.Run("creates correct options object", func(t *testing.T) { | ||
settings := backend.DataSourceInstanceSettings{ | ||
BasicAuthEnabled: false, | ||
BasicAuthUser: "", | ||
JSONData: []byte(`{"httpHeaderName1": "foo"}`), | ||
DecryptedSecureJSONData: map[string]string{ | ||
"httpHeaderValue1": "bar", | ||
}, | ||
} | ||
opts, err := CreateTransportOptions(settings, &azsettings.AzureSettings{}, featuremgmt.WithFeatures(), &logtest.Fake{}) | ||
require.NoError(t, err) | ||
require.Equal(t, map[string]string{"foo": "bar"}, opts.Headers) | ||
}) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.