Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert #169041 #169667

Merged
merged 4 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/plugins/data/common/search/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ export const isAbortResponse = (response?: IKibanaSearchResponse) => {
/**
* @returns true if request is still running
*/
export const isRunningResponse = (response?: IKibanaSearchResponse) => {
return response?.isRunning ?? false;
};
export const isRunningResponse = (response?: IKibanaSearchResponse) => response?.isRunning ?? false;

export const getUserTimeZone = (
getConfig: AggTypesDependencies['getConfig'],
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/data/server/search/routes/bsearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { catchError } from 'rxjs/operators';
import { BfetchServerSetup } from '@kbn/bfetch-plugin/server';
import type { ExecutionContextSetup } from '@kbn/core/server';
import apm from 'elastic-apm-node';
import { getRequestAbortedSignal } from '../..';
import {
IKibanaSearchRequest,
IKibanaSearchResponse,
Expand All @@ -29,7 +28,6 @@ export function registerBsearchRoute(
IKibanaSearchResponse
>('/internal/bsearch', (request) => {
const search = getScoped(request);
const abortSignal = getRequestAbortedSignal(request.events.aborted$);
return {
/**
* @param requestOptions
Expand All @@ -41,7 +39,7 @@ export function registerBsearchRoute(
apm.addLabels(executionContextService.getAsLabels());

return firstValueFrom(
search.search(requestData, { ...restOptions, abortSignal }).pipe(
search.search(requestData, restOptions).pipe(
catchError((err) => {
// Re-throw as object, to get attributes passed to the client
// eslint-disable-next-line no-throw-literal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,38 +260,6 @@ describe('ES search strategy', () => {

expect(mockApiCaller).toBeCalledTimes(0);
});

it('should delete when aborted', async () => {
mockSubmitCaller.mockResolvedValueOnce({
...mockAsyncResponse,
body: {
...mockAsyncResponse.body,
is_running: true,
},
});

const params = { index: 'logstash-*', body: { query: {} } };
const esSearch = await enhancedEsSearchStrategyProvider(
mockLegacyConfig$,
mockSearchConfig,
mockLogger
);
const abortController = new AbortController();
const abortSignal = abortController.signal;

// Abort after an incomplete first response is returned
setTimeout(() => abortController.abort(), 100);

let err: KbnServerError | undefined;
try {
await esSearch.search({ params }, { abortSignal }, mockDeps).toPromise();
} catch (e) {
err = e;
}
expect(mockSubmitCaller).toBeCalled();
expect(err).not.toBeUndefined();
expect(mockDeleteCaller).toBeCalled();
});
});

describe('with sessionId', () => {
Expand Down Expand Up @@ -399,44 +367,6 @@ describe('ES search strategy', () => {
expect(request).toHaveProperty('wait_for_completion_timeout');
expect(request).not.toHaveProperty('keep_alive');
});

it('should not delete a saved session when aborted', async () => {
mockSubmitCaller.mockResolvedValueOnce({
...mockAsyncResponse,
body: {
...mockAsyncResponse.body,
is_running: true,
},
});

const params = { index: 'logstash-*', body: { query: {} } };
const esSearch = await enhancedEsSearchStrategyProvider(
mockLegacyConfig$,
mockSearchConfig,
mockLogger
);
const abortController = new AbortController();
const abortSignal = abortController.signal;

// Abort after an incomplete first response is returned
setTimeout(() => abortController.abort(), 100);

let err: KbnServerError | undefined;
try {
await esSearch
.search(
{ params },
{ abortSignal, sessionId: '1', isSearchStored: true, isStored: true },
mockDeps
)
.toPromise();
} catch (e) {
err = e;
}
expect(mockSubmitCaller).toBeCalled();
expect(err).not.toBeUndefined();
expect(mockDeleteCaller).not.toBeCalled();
});
});

it('throws normalized error if ResponseError is thrown', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export const enhancedEsSearchStrategyProvider = (
};

const cancel = async () => {
if (id && !options.isStored) {
if (id) {
await cancelAsyncSearch(id, esClient);
}
};
Expand Down
4 changes: 1 addition & 3 deletions test/functional/apps/discover/group4/_adhoc_data_views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.dashboard.waitForRenderComplete();
};

// FLAKY: https://github.com/elastic/kibana/issues/169434
// FLAKY: https://github.com/elastic/kibana/issues/169454
describe.skip('adhoc data views', function () {
describe('adhoc data views', function () {
before(async () => {
await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']);
await kibanaServer.importExport.load('test/functional/fixtures/kbn_archiver/discover.json');
Expand Down
4 changes: 1 addition & 3 deletions test/functional/apps/discover/group4/_chart_hidden.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
defaultIndex: 'logstash-*',
};

// FLAKY: https://github.com/elastic/kibana/issues/169458
// FLAKY: https://github.com/elastic/kibana/issues/169459
describe.skip('discover show/hide chart test', function () {
describe('discover show/hide chart test', function () {
before(async function () {
await security.testUser.setRoles(['kibana_admin', 'test_logstash_reader']);
log.debug('load kibana index with default index pattern');
Expand Down
Loading