Alerting: Support context.Context in Loki interface (#61979)

This commit adds support for canceleable contexts in the Loki
interface.
This commit is contained in:
George Robinson
2023-01-26 09:31:20 +00:00
committed by GitHub
parent e6e560e3ed
commit a7eab8e46e
5 changed files with 28 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
package historian
import (
"context"
"net/url"
"testing"
@@ -21,7 +22,7 @@ func TestLokiHTTPClient(t *testing.T) {
}, log.NewNopLogger())
// Unauthorized request should fail against Grafana Cloud.
err = client.ping()
err = client.ping(context.Background())
require.Error(t, err)
client.cfg.BasicAuthUser = "<your_username>"
@@ -32,7 +33,7 @@ func TestLokiHTTPClient(t *testing.T) {
// client.cfg.TenantID = "<your_tenant_id>"
// Authorized request should fail against Grafana Cloud.
err = client.ping()
err = client.ping(context.Background())
require.NoError(t, err)
})
}