From ea3b18b2e27dd40bafddae1e3cb95a73c451a93d Mon Sep 17 00:00:00 2001 From: Samiul Monir Date: Tue, 19 Nov 2024 16:46:10 -0500 Subject: [PATCH] Fix failed tests for index management --- .../index_details_page/index_details_page.test.tsx | 1 - .../index_details_page/select_inference_id.test.tsx | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/index_details_page.test.tsx b/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/index_details_page.test.tsx index 76b8295b6b1f4..5a97dadc870cb 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/index_details_page.test.tsx +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/index_details_page.test.tsx @@ -836,7 +836,6 @@ describe('', () => { testBed.actions.mappings.isReferenceFieldVisible(); testBed.actions.mappings.selectInferenceIdButtonExists(); testBed.actions.mappings.openSelectInferencePopover(); - testBed.actions.mappings.expectDefaultInferenceModelToExists(); testBed.actions.mappings.expectCustomInferenceModelToExists( `custom-inference_${customInferenceModel}` ); diff --git a/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/select_inference_id.test.tsx b/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/select_inference_id.test.tsx index ed5af67840513..41fcb2f03dc33 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/select_inference_id.test.tsx +++ b/x-pack/plugins/index_management/__jest__/client_integration/index_details_page/select_inference_id.test.tsx @@ -71,6 +71,8 @@ jest.mock('../../../public/application/components/mappings_editor/mappings_state jest.mock('../../../public/application/services/api', () => ({ useLoadInferenceEndpoints: jest.fn().mockReturnValue({ data: [ + { inference_id: '.elser-2-elasticsearch', task_type: 'sparse_embedding' }, + { inference_id: '.multilingual-e5-small-elasticsearch', task_type: 'text_embedding' }, { inference_id: 'endpoint-1', task_type: 'text_embedding' }, { inference_id: 'endpoint-2', task_type: 'sparse_embedding' }, { inference_id: 'endpoint-3', task_type: 'completion' }, @@ -83,7 +85,7 @@ jest.mock('../../../public/application/services/api', () => ({ function getTestForm(Component: React.FC) { return (defaultProps: SelectInferenceIdProps) => { const { form } = useForm(); - form.setFieldValue('inference_id', 'elser_model_2'); + form.setFieldValue('inference_id', '.elser-2-elasticsearch'); return (
@@ -125,8 +127,10 @@ describe('SelectInferenceId', () => { it('should display the inference endpoints in the combo', () => { find('inferenceIdButton').simulate('click'); - expect(find('data-inference-endpoint-list').contains('e5')).toBe(true); - expect(find('data-inference-endpoint-list').contains('elser_model_2')).toBe(true); + expect(find('data-inference-endpoint-list').contains('.elser-2-elasticsearch')).toBe(true); + expect( + find('data-inference-endpoint-list').contains('.multilingual-e5-small-elasticsearch') + ).toBe(true); expect(find('data-inference-endpoint-list').contains('endpoint-1')).toBe(true); expect(find('data-inference-endpoint-list').contains('endpoint-2')).toBe(true); expect(find('data-inference-endpoint-list').contains('endpoint-3')).toBe(false);