mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
remove frontend healthcheck
This commit is contained in:
parent
0f82e5226b
commit
676265f39e
@ -141,27 +141,6 @@ describe('ElasticDatasource', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('When testing datasource with index pattern', () => {
|
||||
it('should translate index pattern to current day', async () => {
|
||||
const { ds, fetchMock } = getTestContext({ jsonData: { interval: 'Daily' } });
|
||||
|
||||
await ds.testDatasource();
|
||||
|
||||
const today = toUtc().format('YYYY.MM.DD');
|
||||
const lastCall = fetchMock.mock.calls[fetchMock.mock.calls.length - 1];
|
||||
expect(lastCall[0].url).toBe(`${ELASTICSEARCH_MOCK_URL}/test-${today}/_mapping`);
|
||||
});
|
||||
|
||||
it('should call `/_mapping` with an empty index', async () => {
|
||||
const { ds, fetchMock } = getTestContext({ jsonData: { index: '' } });
|
||||
|
||||
await ds.testDatasource();
|
||||
|
||||
const lastCall = fetchMock.mock.calls[fetchMock.mock.calls.length - 1];
|
||||
expect(lastCall[0].url).toBe(`${ELASTICSEARCH_MOCK_URL}/_mapping`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('When issuing metric query with interval pattern', () => {
|
||||
async function runScenario() {
|
||||
const range = { from: toUtc([2015, 4, 30, 10]), to: toUtc([2015, 5, 1, 10]), raw: { from: '', to: '' } };
|
||||
|
@ -427,34 +427,6 @@ export class ElasticDatasource
|
||||
return queries.map((q) => this.applyTemplateVariables(q, scopedVars, filters));
|
||||
}
|
||||
|
||||
async testDatasource() {
|
||||
// we explicitly ask for uncached, "fresh" data here
|
||||
const dbVersion = await this.getDatabaseVersion(false);
|
||||
// if we are not able to determine the elastic-version, we assume it is a good version.
|
||||
const isSupported = dbVersion != null ? isSupportedVersion(dbVersion) : true;
|
||||
const versionMessage = isSupported ? '' : `WARNING: ${unsupportedVersionMessage} `;
|
||||
// validate that the index exist and has date field
|
||||
return lastValueFrom(
|
||||
this.getFields(['date']).pipe(
|
||||
mergeMap((dateFields) => {
|
||||
const timeField = find(dateFields, { text: this.timeField });
|
||||
if (!timeField) {
|
||||
return of({
|
||||
status: 'error',
|
||||
message: 'No date field named ' + this.timeField + ' found',
|
||||
});
|
||||
}
|
||||
return of({ status: 'success', message: `${versionMessage}Data source successfully connected.` });
|
||||
}),
|
||||
catchError((err) => {
|
||||
const infoInParentheses = err.message ? ` (${err.message})` : '';
|
||||
const message = `Unable to connect with Elasticsearch${infoInParentheses}. Please check the server logs for more details.`;
|
||||
return of({ status: 'error', message });
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
getQueryHeader(searchType: string, timeFrom?: DateTime, timeTo?: DateTime): string {
|
||||
const queryHeader = {
|
||||
search_type: searchType,
|
||||
|
Loading…
Reference in New Issue
Block a user