Loki: Handle data source configs with path in the url (#50971)

* loki: fixed param-name

* loki: handle datasource configs with path in the url

* lint fix
This commit is contained in:
Gábor Farkas
2022-06-17 07:47:31 +02:00
committed by GitHub
parent 8f5912b94c
commit ccc587dc0f
3 changed files with 143 additions and 8 deletions
+5 -1
View File
@@ -33,9 +33,13 @@ func (mockedRT *mockedRoundTripper) RoundTrip(req *http.Request) (*http.Response
}
func makeMockedAPI(statusCode int, contentType string, responseBytes []byte, requestCallback mockRequestCallback) *LokiAPI {
return makeMockedAPIWithUrl("http://localhost:9999", statusCode, contentType, responseBytes, requestCallback)
}
func makeMockedAPIWithUrl(url string, statusCode int, contentType string, responseBytes []byte, requestCallback mockRequestCallback) *LokiAPI {
client := http.Client{
Transport: &mockedRoundTripper{statusCode: statusCode, contentType: contentType, responseBytes: responseBytes, requestCallback: requestCallback},
}
return newLokiAPI(&client, "http://localhost:9999", log.New("test"), nil)
return newLokiAPI(&client, url, log.New("test"), nil)
}