Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinwcyu committed Dec 30, 2024
1 parent 3f019e0 commit cd0da39
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/DatasourceWithAsyncBackend.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ describe('DatasourceWithAsyncBackend', () => {
expect(ds.doSingle).toHaveBeenCalledWith(defaultQuery2, defaultRequest);
});

it('uses the datasource id for the request id', () => {
it('uses the datasource uid for the request uid', () => {
const ds = setupDatasourceWithAsyncBackend();
expect(getRequestLooperMock).not.toHaveBeenCalled();
ds.doSingle(defaultQuery, defaultRequest);
expect(getRequestLooperMock).toHaveBeenCalledTimes(1);
const expectedRequest = {
...defaultRequest,
targets: [defaultQuery],
requestId: '12_100',
requestId: 'test_100',
};
expect(getRequestLooperMock).toHaveBeenCalledWith(expectedRequest, expect.anything());
});
Expand Down
3 changes: 1 addition & 2 deletions src/DatasourceWithAsyncBackend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import { catchError, map } from 'rxjs/operators';
import { gte } from 'semver';
import { getRequestLooper } from './requestLooper';

const requestSupportsSkipQueryCache = gte(config.buildInfo.version, '10.2.3');

export interface CustomMeta {
queryID: string;
status: string;
Expand Down Expand Up @@ -133,6 +131,7 @@ export class DatasourceWithAsyncBackend<
// The caching service handles bypassing the query cache automatically when it is enabled.
const cachingDisabled = !config.featureToggles.awsAsyncQueryCaching;
if (cachingDisabled && isRunning(status)) {
const requestSupportsSkipQueryCache = gte(config.buildInfo.version, '10.2.3');
if (!requestSupportsSkipQueryCache) {
return getBackendSrv()
.fetch<BackendDataSourceResponse>({
Expand Down

0 comments on commit cd0da39

Please sign in to comment.