mirror of
https://github.com/grafana/grafana.git
synced 2025-09-23 14:53:03 +08:00
Add timeout option to datasource config (#31871)
This commit is contained in:
@ -214,6 +214,25 @@ func TestDataSource_GetHttpTransport(t *testing.T) {
|
||||
assert.Equal(t, "Ok", bodyStr)
|
||||
})
|
||||
|
||||
t.Run("Should use request timeout if configured in JsonData", func(t *testing.T) {
|
||||
clearDSProxyCache(t)
|
||||
|
||||
json := simplejson.NewFromAny(map[string]interface{}{
|
||||
"timeout": 19,
|
||||
})
|
||||
ds := DataSource{
|
||||
Id: 1,
|
||||
Url: "http://k8s:8001",
|
||||
Type: "Kubernetes",
|
||||
JsonData: json,
|
||||
}
|
||||
|
||||
client, err := ds.GetHttpClient()
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, 19*time.Second, client.Timeout)
|
||||
})
|
||||
|
||||
t.Run("Should not include SigV4 middleware if not configured in JsonData", func(t *testing.T) {
|
||||
clearDSProxyCache(t)
|
||||
|
||||
|
Reference in New Issue
Block a user