mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Loki: Update mocks and move into __mocks__ (#79993)
Loki: Update mocks and move into __mocks__
This commit is contained in:
parent
a8fb01a502
commit
c48e2c7d0d
@ -2,8 +2,9 @@ import { AbstractLabelOperator, DataFrame, TimeRange, dateTime, getDefaultTimeRa
|
|||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
|
|
||||||
import LanguageProvider from './LanguageProvider';
|
import LanguageProvider from './LanguageProvider';
|
||||||
|
import { createLokiDatasource } from './__mocks__/datasource';
|
||||||
|
import { createMetadataRequest } from './__mocks__/metadataRequest';
|
||||||
import { DEFAULT_MAX_LINES_SAMPLE, LokiDatasource } from './datasource';
|
import { DEFAULT_MAX_LINES_SAMPLE, LokiDatasource } from './datasource';
|
||||||
import { createLokiDatasource, createMetadataRequest } from './mocks';
|
|
||||||
import {
|
import {
|
||||||
extractLogParserFromDataFrame,
|
extractLogParserFromDataFrame,
|
||||||
extractLabelKeysFromDataFrame,
|
extractLabelKeysFromDataFrame,
|
||||||
|
@ -15,7 +15,7 @@ import {
|
|||||||
LOKI_LOG_CONTEXT_PRESERVED_LABELS,
|
LOKI_LOG_CONTEXT_PRESERVED_LABELS,
|
||||||
SHOULD_INCLUDE_PIPELINE_OPERATIONS,
|
SHOULD_INCLUDE_PIPELINE_OPERATIONS,
|
||||||
} from './LogContextProvider';
|
} from './LogContextProvider';
|
||||||
import { createLokiDatasource } from './mocks';
|
import { createLokiDatasource } from './__mocks__/datasource';
|
||||||
import { LokiQuery } from './types';
|
import { LokiQuery } from './types';
|
||||||
|
|
||||||
const defaultLanguageProviderMock = {
|
const defaultLanguageProviderMock = {
|
||||||
|
@ -3,8 +3,9 @@ import { firstValueFrom } from 'rxjs';
|
|||||||
import { dateTime, getDefaultTimeRange } from '@grafana/data';
|
import { dateTime, getDefaultTimeRange } from '@grafana/data';
|
||||||
|
|
||||||
import { LokiVariableSupport } from './LokiVariableSupport';
|
import { LokiVariableSupport } from './LokiVariableSupport';
|
||||||
|
import { createLokiDatasource } from './__mocks__/datasource';
|
||||||
|
import { createMetadataRequest } from './__mocks__/metadataRequest';
|
||||||
import { LokiDatasource } from './datasource';
|
import { LokiDatasource } from './datasource';
|
||||||
import { createLokiDatasource, createMetadataRequest } from './mocks';
|
|
||||||
import { LokiVariableQueryType } from './types';
|
import { LokiVariableQueryType } from './types';
|
||||||
|
|
||||||
describe('LokiVariableSupport', () => {
|
describe('LokiVariableSupport', () => {
|
||||||
|
59
public/app/plugins/datasource/loki/__mocks__/datasource.ts
Normal file
59
public/app/plugins/datasource/loki/__mocks__/datasource.ts
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
import { DataSourceInstanceSettings, DataSourceSettings, PluginType } from '@grafana/data';
|
||||||
|
import { TemplateSrv } from '@grafana/runtime';
|
||||||
|
|
||||||
|
import { LokiDatasource } from '../datasource';
|
||||||
|
import { LokiOptions } from '../types';
|
||||||
|
|
||||||
|
export function createDefaultConfigOptions() {
|
||||||
|
return {
|
||||||
|
jsonData: { maxLines: '531' },
|
||||||
|
secureJsonFields: {},
|
||||||
|
} as DataSourceSettings<LokiOptions>;
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultTemplateSrvMock = {
|
||||||
|
replace: (input: string) => input,
|
||||||
|
getVariables: () => [],
|
||||||
|
};
|
||||||
|
|
||||||
|
export function createLokiDatasource(
|
||||||
|
templateSrvMock: Partial<TemplateSrv> = defaultTemplateSrvMock,
|
||||||
|
settings: Partial<DataSourceInstanceSettings<LokiOptions>> = {}
|
||||||
|
): LokiDatasource {
|
||||||
|
const customSettings: DataSourceInstanceSettings<LokiOptions> = {
|
||||||
|
url: 'myloggingurl',
|
||||||
|
id: 0,
|
||||||
|
uid: '',
|
||||||
|
type: '',
|
||||||
|
name: '',
|
||||||
|
meta: {
|
||||||
|
id: 'id',
|
||||||
|
name: 'name',
|
||||||
|
type: PluginType.datasource,
|
||||||
|
module: '',
|
||||||
|
baseUrl: '',
|
||||||
|
info: {
|
||||||
|
author: {
|
||||||
|
name: 'Test',
|
||||||
|
},
|
||||||
|
description: '',
|
||||||
|
links: [],
|
||||||
|
logos: {
|
||||||
|
large: '',
|
||||||
|
small: '',
|
||||||
|
},
|
||||||
|
screenshots: [],
|
||||||
|
updated: '',
|
||||||
|
version: '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
readOnly: false,
|
||||||
|
jsonData: {
|
||||||
|
maxLines: '20',
|
||||||
|
},
|
||||||
|
access: 'direct',
|
||||||
|
...settings,
|
||||||
|
};
|
||||||
|
|
||||||
|
return new LokiDatasource(customSettings, templateSrvMock as TemplateSrv);
|
||||||
|
}
|
@ -1,113 +1,4 @@
|
|||||||
import {
|
import { DataFrame, DataFrameType, FieldType } from '@grafana/data';
|
||||||
DataFrame,
|
|
||||||
DataFrameType,
|
|
||||||
DataSourceInstanceSettings,
|
|
||||||
DataSourceSettings,
|
|
||||||
FieldType,
|
|
||||||
PluginType,
|
|
||||||
toUtc,
|
|
||||||
} from '@grafana/data';
|
|
||||||
import { TemplateSrv } from '@grafana/runtime';
|
|
||||||
|
|
||||||
import { getMockDataSource } from '../../../features/datasources/__mocks__';
|
|
||||||
|
|
||||||
import { LokiDatasource } from './datasource';
|
|
||||||
import { LokiOptions } from './types';
|
|
||||||
|
|
||||||
export function createDefaultConfigOptions(): DataSourceSettings<LokiOptions> {
|
|
||||||
return getMockDataSource<LokiOptions>({
|
|
||||||
jsonData: { maxLines: '531' },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const rawRange = {
|
|
||||||
from: toUtc('2018-04-25 10:00'),
|
|
||||||
to: toUtc('2018-04-25 11:00'),
|
|
||||||
};
|
|
||||||
|
|
||||||
const defaultTimeSrvMock = {
|
|
||||||
timeRange: jest.fn().mockReturnValue({
|
|
||||||
from: rawRange.from,
|
|
||||||
to: rawRange.to,
|
|
||||||
raw: rawRange,
|
|
||||||
}),
|
|
||||||
};
|
|
||||||
|
|
||||||
const defaultTemplateSrvMock = {
|
|
||||||
replace: (input: string) => input,
|
|
||||||
getVariables: () => [],
|
|
||||||
};
|
|
||||||
|
|
||||||
export function createLokiDatasource(
|
|
||||||
templateSrvMock: Partial<TemplateSrv> = defaultTemplateSrvMock,
|
|
||||||
settings: Partial<DataSourceInstanceSettings<LokiOptions>> = {},
|
|
||||||
timeSrvStub = defaultTimeSrvMock
|
|
||||||
): LokiDatasource {
|
|
||||||
const customSettings: DataSourceInstanceSettings<LokiOptions> = {
|
|
||||||
url: 'myloggingurl',
|
|
||||||
id: 0,
|
|
||||||
uid: '',
|
|
||||||
type: '',
|
|
||||||
name: '',
|
|
||||||
meta: {
|
|
||||||
id: 'id',
|
|
||||||
name: 'name',
|
|
||||||
type: PluginType.datasource,
|
|
||||||
module: '',
|
|
||||||
baseUrl: '',
|
|
||||||
info: {
|
|
||||||
author: {
|
|
||||||
name: 'Test',
|
|
||||||
},
|
|
||||||
description: '',
|
|
||||||
links: [],
|
|
||||||
logos: {
|
|
||||||
large: '',
|
|
||||||
small: '',
|
|
||||||
},
|
|
||||||
screenshots: [],
|
|
||||||
updated: '',
|
|
||||||
version: '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
readOnly: false,
|
|
||||||
jsonData: {
|
|
||||||
maxLines: '20',
|
|
||||||
},
|
|
||||||
access: 'direct',
|
|
||||||
...settings,
|
|
||||||
};
|
|
||||||
|
|
||||||
// @ts-expect-error
|
|
||||||
return new LokiDatasource(customSettings, templateSrvMock, timeSrvStub);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createMetadataRequest(
|
|
||||||
labelsAndValues: Record<string, string[]>,
|
|
||||||
series?: Record<string, Array<Record<string, string>>>
|
|
||||||
) {
|
|
||||||
// added % to allow urlencoded labelKeys. Note, that this is not confirm with Loki, as loki does not allow specialcharacters in labelKeys, but needed for tests.
|
|
||||||
const lokiLabelsAndValuesEndpointRegex = /^label\/([%\w]*)\/values/;
|
|
||||||
const lokiSeriesEndpointRegex = /^series/;
|
|
||||||
const lokiLabelsEndpoint = 'labels';
|
|
||||||
const labels = Object.keys(labelsAndValues);
|
|
||||||
|
|
||||||
return async function metadataRequestMock(url: string, params?: Record<string, string | number>) {
|
|
||||||
if (url === lokiLabelsEndpoint) {
|
|
||||||
return labels;
|
|
||||||
} else {
|
|
||||||
const labelsMatch = url.match(lokiLabelsAndValuesEndpointRegex);
|
|
||||||
const seriesMatch = url.match(lokiSeriesEndpointRegex);
|
|
||||||
if (labelsMatch) {
|
|
||||||
return labelsAndValues[labelsMatch[1]] || [];
|
|
||||||
} else if (seriesMatch && series && params) {
|
|
||||||
return series[params['match[]']] || [];
|
|
||||||
} else {
|
|
||||||
throw new Error(`Unexpected url error, ${url}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getMockFrames() {
|
export function getMockFrames() {
|
||||||
const logFrameA: DataFrame = {
|
const logFrameA: DataFrame = {
|
@ -0,0 +1,26 @@
|
|||||||
|
export function createMetadataRequest(
|
||||||
|
labelsAndValues: Record<string, string[]>,
|
||||||
|
series?: Record<string, Array<Record<string, string>>>
|
||||||
|
) {
|
||||||
|
// added % to allow urlencoded labelKeys. Note, that this is not confirm with Loki, as loki does not allow specialcharacters in labelKeys, but needed for tests.
|
||||||
|
const lokiLabelsAndValuesEndpointRegex = /^label\/([%\w]*)\/values/;
|
||||||
|
const lokiSeriesEndpointRegex = /^series/;
|
||||||
|
const lokiLabelsEndpoint = 'labels';
|
||||||
|
const labels = Object.keys(labelsAndValues);
|
||||||
|
|
||||||
|
return async function metadataRequestMock(url: string, params?: Record<string, string | number>) {
|
||||||
|
if (url === lokiLabelsEndpoint) {
|
||||||
|
return labels;
|
||||||
|
} else {
|
||||||
|
const labelsMatch = url.match(lokiLabelsAndValuesEndpointRegex);
|
||||||
|
const seriesMatch = url.match(lokiSeriesEndpointRegex);
|
||||||
|
if (labelsMatch) {
|
||||||
|
return labelsAndValues[labelsMatch[1]] || [];
|
||||||
|
} else if (seriesMatch && series && params) {
|
||||||
|
return series[params['match[]']] || [];
|
||||||
|
} else {
|
||||||
|
throw new Error(`Unexpected url error, ${url}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
@ -6,7 +6,7 @@ import React from 'react';
|
|||||||
import { CoreApp } from '@grafana/data';
|
import { CoreApp } from '@grafana/data';
|
||||||
import { QueryEditorMode } from 'app/plugins/datasource/prometheus/querybuilder/shared/types';
|
import { QueryEditorMode } from 'app/plugins/datasource/prometheus/querybuilder/shared/types';
|
||||||
|
|
||||||
import { createLokiDatasource } from '../mocks';
|
import { createLokiDatasource } from '../__mocks__/datasource';
|
||||||
import { EXPLAIN_LABEL_FILTER_CONTENT } from '../querybuilder/components/LokiQueryBuilderExplained';
|
import { EXPLAIN_LABEL_FILTER_CONTENT } from '../querybuilder/components/LokiQueryBuilderExplained';
|
||||||
import { LokiQuery, LokiQueryType } from '../types';
|
import { LokiQuery, LokiQueryType } from '../types';
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import React from 'react';
|
|||||||
|
|
||||||
import { CoreApp } from '@grafana/data';
|
import { CoreApp } from '@grafana/data';
|
||||||
|
|
||||||
import { createLokiDatasource } from '../mocks';
|
import { createLokiDatasource } from '../__mocks__/datasource';
|
||||||
|
|
||||||
import { testIds as regularTestIds } from './LokiQueryEditor';
|
import { testIds as regularTestIds } from './LokiQueryEditor';
|
||||||
import { LokiQueryEditorByApp } from './LokiQueryEditorByApp';
|
import { LokiQueryEditorByApp } from './LokiQueryEditorByApp';
|
||||||
|
@ -3,7 +3,7 @@ import React, { ComponentProps } from 'react';
|
|||||||
|
|
||||||
import { dateTime } from '@grafana/data';
|
import { dateTime } from '@grafana/data';
|
||||||
|
|
||||||
import { createLokiDatasource } from '../mocks';
|
import { createLokiDatasource } from '../__mocks__/datasource';
|
||||||
|
|
||||||
import { LokiQueryField } from './LokiQueryField';
|
import { LokiQueryField } from './LokiQueryField';
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
|||||||
|
|
||||||
import { TemplateSrv } from '@grafana/runtime';
|
import { TemplateSrv } from '@grafana/runtime';
|
||||||
|
|
||||||
import { createLokiDatasource } from '../mocks';
|
import { createLokiDatasource } from '../__mocks__/datasource';
|
||||||
import { LokiVariableQueryType } from '../types';
|
import { LokiVariableQueryType } from '../types';
|
||||||
|
|
||||||
import { LokiVariableQueryEditor, Props } from './VariableQueryEditor';
|
import { LokiVariableQueryEditor, Props } from './VariableQueryEditor';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen } from '@testing-library/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { createLokiDatasource } from '../../mocks';
|
import { createLokiDatasource } from '../../__mocks__/datasource';
|
||||||
|
|
||||||
import { MonacoQueryFieldWrapper, Props } from './MonacoQueryFieldWrapper';
|
import { MonacoQueryFieldWrapper, Props } from './MonacoQueryFieldWrapper';
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen } from '@testing-library/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { createLokiDatasource } from '../../mocks';
|
import { createLokiDatasource } from '../../__mocks__/datasource';
|
||||||
|
|
||||||
import MonacoQueryField from './MonacoQueryField';
|
import MonacoQueryField from './MonacoQueryField';
|
||||||
import { Props } from './MonacoQueryFieldProps';
|
import { Props } from './MonacoQueryFieldProps';
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { HistoryItem, dateTime } from '@grafana/data';
|
import { HistoryItem, dateTime } from '@grafana/data';
|
||||||
|
|
||||||
import LokiLanguageProvider from '../../../LanguageProvider';
|
import LokiLanguageProvider from '../../../LanguageProvider';
|
||||||
|
import { createLokiDatasource } from '../../../__mocks__/datasource';
|
||||||
import { LokiDatasource } from '../../../datasource';
|
import { LokiDatasource } from '../../../datasource';
|
||||||
import { createLokiDatasource } from '../../../mocks';
|
|
||||||
import { LokiQuery } from '../../../types';
|
import { LokiQuery } from '../../../types';
|
||||||
|
|
||||||
import { CompletionDataProvider } from './CompletionDataProvider';
|
import { CompletionDataProvider } from './CompletionDataProvider';
|
||||||
|
@ -2,8 +2,8 @@ import { dateTime } from '@grafana/data';
|
|||||||
import { Monaco, monacoTypes } from '@grafana/ui/src';
|
import { Monaco, monacoTypes } from '@grafana/ui/src';
|
||||||
|
|
||||||
import LokiLanguageProvider from '../../../LanguageProvider';
|
import LokiLanguageProvider from '../../../LanguageProvider';
|
||||||
|
import { createLokiDatasource } from '../../../__mocks__/datasource';
|
||||||
import { LokiDatasource } from '../../../datasource';
|
import { LokiDatasource } from '../../../datasource';
|
||||||
import { createLokiDatasource } from '../../../mocks';
|
|
||||||
|
|
||||||
import { CompletionDataProvider } from './CompletionDataProvider';
|
import { CompletionDataProvider } from './CompletionDataProvider';
|
||||||
import { calculateRange } from './completionUtils';
|
import { calculateRange } from './completionUtils';
|
||||||
|
@ -2,7 +2,7 @@ import { render, screen } from '@testing-library/react';
|
|||||||
import userEvent from '@testing-library/user-event';
|
import userEvent from '@testing-library/user-event';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { createDefaultConfigOptions } from '../mocks';
|
import { createDefaultConfigOptions } from '../__mocks__/datasource';
|
||||||
|
|
||||||
import { AlertingSettings } from './AlertingSettings';
|
import { AlertingSettings } from './AlertingSettings';
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import { render, screen } from '@testing-library/react';
|
|||||||
import userEvent from '@testing-library/user-event';
|
import userEvent from '@testing-library/user-event';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { createDefaultConfigOptions } from '../mocks';
|
import { createDefaultConfigOptions } from '../__mocks__/datasource';
|
||||||
|
|
||||||
import { ConfigEditor } from './ConfigEditor';
|
import { ConfigEditor } from './ConfigEditor';
|
||||||
|
|
||||||
|
@ -31,8 +31,9 @@ import {
|
|||||||
} from '@grafana/runtime';
|
} from '@grafana/runtime';
|
||||||
|
|
||||||
import { LokiVariableSupport } from './LokiVariableSupport';
|
import { LokiVariableSupport } from './LokiVariableSupport';
|
||||||
|
import { createLokiDatasource } from './__mocks__/datasource';
|
||||||
|
import { createMetadataRequest } from './__mocks__/metadataRequest';
|
||||||
import { LokiDatasource, REF_ID_DATA_SAMPLES } from './datasource';
|
import { LokiDatasource, REF_ID_DATA_SAMPLES } from './datasource';
|
||||||
import { createLokiDatasource, createMetadataRequest } from './mocks';
|
|
||||||
import { runSplitQuery } from './querySplitting';
|
import { runSplitQuery } from './querySplitting';
|
||||||
import { parseToNodeNamesArray } from './queryUtils';
|
import { parseToNodeNamesArray } from './queryUtils';
|
||||||
import { LokiOptions, LokiQuery, LokiQueryType, LokiVariableQueryType, SupportingQueryType } from './types';
|
import { LokiOptions, LokiQuery, LokiQueryType, LokiVariableQueryType, SupportingQueryType } from './types';
|
||||||
|
@ -3,10 +3,11 @@ import { getQueryOptions } from 'test/helpers/getQueryOptions';
|
|||||||
|
|
||||||
import { dateTime, LoadingState } from '@grafana/data';
|
import { dateTime, LoadingState } from '@grafana/data';
|
||||||
|
|
||||||
|
import { createLokiDatasource } from './__mocks__/datasource';
|
||||||
|
import { getMockFrames } from './__mocks__/frames';
|
||||||
import { LokiDatasource } from './datasource';
|
import { LokiDatasource } from './datasource';
|
||||||
import * as logsTimeSplit from './logsTimeSplitting';
|
import * as logsTimeSplit from './logsTimeSplitting';
|
||||||
import * as metricTimeSplit from './metricTimeSplitting';
|
import * as metricTimeSplit from './metricTimeSplitting';
|
||||||
import { createLokiDatasource, getMockFrames } from './mocks';
|
|
||||||
import { runSplitQuery } from './querySplitting';
|
import { runSplitQuery } from './querySplitting';
|
||||||
import { trackGroupedQueries } from './tracking';
|
import { trackGroupedQueries } from './tracking';
|
||||||
import { LokiQuery, LokiQueryType } from './types';
|
import { LokiQuery, LokiQueryType } from './types';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { String } from '@grafana/lezer-logql';
|
import { String } from '@grafana/lezer-logql';
|
||||||
|
|
||||||
import { createLokiDatasource } from './mocks';
|
import { createLokiDatasource } from './__mocks__/datasource';
|
||||||
import {
|
import {
|
||||||
getHighlighterExpressionsFromQuery,
|
getHighlighterExpressionsFromQuery,
|
||||||
getLokiQueryType,
|
getLokiQueryType,
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { render, screen, waitFor } from '@testing-library/react';
|
import { render, screen, waitFor } from '@testing-library/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
import { createLokiDatasource } from '../../__mocks__/datasource';
|
||||||
import { LokiDatasource } from '../../datasource';
|
import { LokiDatasource } from '../../datasource';
|
||||||
import { createLokiDatasource } from '../../mocks';
|
|
||||||
import { LokiQuery } from '../../types';
|
import { LokiQuery } from '../../types';
|
||||||
|
|
||||||
import { LabelBrowserModal, Props } from './LabelBrowserModal';
|
import { LabelBrowserModal, Props } from './LabelBrowserModal';
|
||||||
|
@ -6,7 +6,7 @@ import { getSelectParent } from 'test/helpers/selectOptionInTest';
|
|||||||
import { dateTime } from '@grafana/data';
|
import { dateTime } from '@grafana/data';
|
||||||
|
|
||||||
import { MISSING_LABEL_FILTER_ERROR_MESSAGE } from '../../../prometheus/querybuilder/shared/LabelFilters';
|
import { MISSING_LABEL_FILTER_ERROR_MESSAGE } from '../../../prometheus/querybuilder/shared/LabelFilters';
|
||||||
import { createLokiDatasource } from '../../mocks';
|
import { createLokiDatasource } from '../../__mocks__/datasource';
|
||||||
import { LokiOperationId, LokiVisualQuery } from '../types';
|
import { LokiOperationId, LokiVisualQuery } from '../types';
|
||||||
|
|
||||||
import { LokiQueryBuilder } from './LokiQueryBuilder';
|
import { LokiQueryBuilder } from './LokiQueryBuilder';
|
||||||
|
@ -3,7 +3,7 @@ import userEvent from '@testing-library/user-event';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { getSelectParent } from 'test/helpers/selectOptionInTest';
|
import { getSelectParent } from 'test/helpers/selectOptionInTest';
|
||||||
|
|
||||||
import { createLokiDatasource } from '../../mocks';
|
import { createLokiDatasource } from '../../__mocks__/datasource';
|
||||||
|
|
||||||
import { LokiQueryBuilderContainer } from './LokiQueryBuilderContainer';
|
import { LokiQueryBuilderContainer } from './LokiQueryBuilderContainer';
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen } from '@testing-library/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { createLokiDatasource } from '../../mocks';
|
import { createLokiDatasource } from '../../__mocks__/datasource';
|
||||||
import { LokiQuery } from '../../types';
|
import { LokiQuery } from '../../types';
|
||||||
|
|
||||||
import { EXPLAIN_LABEL_FILTER_CONTENT } from './LokiQueryBuilderExplained';
|
import { EXPLAIN_LABEL_FILTER_CONTENT } from './LokiQueryBuilderExplained';
|
||||||
|
@ -2,7 +2,7 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|||||||
import userEvent from '@testing-library/user-event';
|
import userEvent from '@testing-library/user-event';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { createLokiDatasource } from '../../mocks';
|
import { createLokiDatasource } from '../../__mocks__/datasource';
|
||||||
import { LokiVisualQueryBinary } from '../types';
|
import { LokiVisualQueryBinary } from '../types';
|
||||||
|
|
||||||
import { NestedQuery, Props as NestedQueryProps } from './NestedQuery';
|
import { NestedQuery, Props as NestedQueryProps } from './NestedQuery';
|
||||||
|
@ -2,8 +2,8 @@ import { render, screen, waitFor } from '@testing-library/react';
|
|||||||
import userEvent from '@testing-library/user-event';
|
import userEvent from '@testing-library/user-event';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
import { createLokiDatasource } from '../../__mocks__/datasource';
|
||||||
import { LokiDatasource } from '../../datasource';
|
import { LokiDatasource } from '../../datasource';
|
||||||
import { createLokiDatasource } from '../../mocks';
|
|
||||||
import { LokiVisualQuery, LokiVisualQueryBinary } from '../types';
|
import { LokiVisualQuery, LokiVisualQueryBinary } from '../types';
|
||||||
|
|
||||||
import { EXPLAIN_LABEL_FILTER_CONTENT } from './LokiQueryBuilderExplained';
|
import { EXPLAIN_LABEL_FILTER_CONTENT } from './LokiQueryBuilderExplained';
|
||||||
|
@ -9,8 +9,8 @@ import {
|
|||||||
QueryBuilderOperationParamDef,
|
QueryBuilderOperationParamDef,
|
||||||
} from 'app/plugins/datasource/prometheus/querybuilder/shared/types';
|
} from 'app/plugins/datasource/prometheus/querybuilder/shared/types';
|
||||||
|
|
||||||
|
import { createLokiDatasource } from '../../__mocks__/datasource';
|
||||||
import { LokiDatasource } from '../../datasource';
|
import { LokiDatasource } from '../../datasource';
|
||||||
import { createLokiDatasource } from '../../mocks';
|
|
||||||
import { LokiOperationId } from '../types';
|
import { LokiOperationId } from '../types';
|
||||||
|
|
||||||
import { UnwrapParamEditor } from './UnwrapParamEditor';
|
import { UnwrapParamEditor } from './UnwrapParamEditor';
|
||||||
|
@ -2,7 +2,7 @@ import { cloneDeep } from 'lodash';
|
|||||||
|
|
||||||
import { DataQueryResponse, QueryResultMetaStat, DataFrame, FieldType } from '@grafana/data';
|
import { DataQueryResponse, QueryResultMetaStat, DataFrame, FieldType } from '@grafana/data';
|
||||||
|
|
||||||
import { getMockFrames } from './mocks';
|
import { getMockFrames } from './__mocks__/frames';
|
||||||
import {
|
import {
|
||||||
dataFrameHasLevelLabel,
|
dataFrameHasLevelLabel,
|
||||||
dataFrameHasLokiError,
|
dataFrameHasLokiError,
|
||||||
|
Loading…
Reference in New Issue
Block a user