Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
afharo authored Jan 21, 2025
1 parent adb6cde commit db6a1b0
Showing 3 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -80,12 +80,10 @@ describe('AIAssistantDataClient', () => {
});
const reader = await assistantConversationsDataClient.getReader();
const query = { query: { bool: { filter: { range: { '@timestamp': { gte: 0 } } } } } };
await reader.search({
body: query,
});
await reader.search(query);

expect(clusterClient.search).toHaveBeenCalledWith({
body: query,
...query,
ignore_unavailable: true,
index: '.kibana-elastic-ai-assistant-conversations-default',
seq_no_primary_term: true,
@@ -102,11 +100,9 @@ describe('AIAssistantDataClient', () => {
const reader = await assistantConversationsDataClient.getReader();
const query = { query: { bool: { filter: { range: { '@timestamp': { gte: 0 } } } } } };

await expect(
reader.search({
body: query,
})
).rejects.toThrowErrorMatchingInlineSnapshot(`"something went wrong!"`);
await expect(reader.search(query)).rejects.toThrowErrorMatchingInlineSnapshot(
`"something went wrong!"`
);

expect(logger.error).toHaveBeenCalledWith(
`Error performing search in AIAssistantDataClient - something went wrong!`
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ import {
MlTrainedModelDeploymentNodesStats,
MlTrainedModelStats,
SearchTotalHits,
QueryDslQueryContainer,
} from '@elastic/elasticsearch/lib/api/types';
import type { MlPluginSetup } from '@kbn/ml-plugin/server';
import type { KibanaRequest } from '@kbn/core-http-server';
@@ -23,7 +24,6 @@ import {
Metadata,
} from '@kbn/elastic-assistant-common';
import pRetry from 'p-retry';
import { QueryDslQueryContainer } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { StructuredTool } from '@langchain/core/tools';
import { AnalyticsServiceSetup, AuditLogger, ElasticsearchClient } from '@kbn/core/server';
import { IndexPatternsFetcher } from '@kbn/data-views-plugin/server';
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
*/

import { elasticsearchServiceMock, loggingSystemMock } from '@kbn/core/server/mocks';
import { IndicesGetDataStreamResponse } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { IndicesGetDataStreamResponse } from '@elastic/elasticsearch/lib/api/types';
import { errors as EsErrors } from '@elastic/elasticsearch';
import { ReplaySubject, Subject } from 'rxjs';
import { taskManagerMock } from '@kbn/task-manager-plugin/server/mocks';

0 comments on commit db6a1b0

Please sign in to comment.