|
|
|
@ -12,7 +12,7 @@ import { |
|
|
|
|
MutableDataFrame, |
|
|
|
|
toUtc, |
|
|
|
|
} from '@grafana/data'; |
|
|
|
|
import { BackendSrvRequest, FetchResponse, config } from '@grafana/runtime'; |
|
|
|
|
import { BackendSrvRequest, FetchResponse } from '@grafana/runtime'; |
|
|
|
|
|
|
|
|
|
import LokiDatasource, { RangeQueryOptions } from './datasource'; |
|
|
|
|
import { LokiQuery, LokiResponse, LokiResultType } from './types'; |
|
|
|
@ -29,12 +29,6 @@ jest.mock('@grafana/runtime', () => ({ |
|
|
|
|
// @ts-ignore
|
|
|
|
|
...jest.requireActual('@grafana/runtime'), |
|
|
|
|
getBackendSrv: () => backendSrv, |
|
|
|
|
config: { |
|
|
|
|
...(jest.requireActual('@grafana/runtime') as unknown as any).config, |
|
|
|
|
featureToggles: { |
|
|
|
|
fullRangeLogsVolume: true, |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
})); |
|
|
|
|
|
|
|
|
|
const rawRange = { |
|
|
|
@ -972,11 +966,6 @@ describe('LokiDatasource', () => { |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
describe('logs volume data provider', () => { |
|
|
|
|
describe('when feature toggle is enabled', () => { |
|
|
|
|
beforeEach(() => { |
|
|
|
|
config.featureToggles.fullRangeLogsVolume = true; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('creates provider for logs query', () => { |
|
|
|
|
const ds = createLokiDSForTests(); |
|
|
|
|
const options = getQueryOptions<LokiQuery>({ |
|
|
|
@ -1008,22 +997,6 @@ describe('LokiDatasource', () => { |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
describe('when feature toggle is disabled', () => { |
|
|
|
|
beforeEach(() => { |
|
|
|
|
config.featureToggles.fullRangeLogsVolume = false; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('does not create a provider for logs query', () => { |
|
|
|
|
const ds = createLokiDSForTests(); |
|
|
|
|
const options = getQueryOptions<LokiQuery>({ |
|
|
|
|
targets: [{ expr: '{label=value}', refId: 'A' }], |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
expect(ds.getLogsVolumeDataProvider(options)).not.toBeDefined(); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
describe('importing queries', () => { |
|
|
|
|
it('keeps all labels when no labels are loaded', async () => { |
|
|
|
|
const ds = createLokiDSForTests(); |
|
|
|
|