From f9700fe0254f1af15d855a80ff1ad0b73fad7179 Mon Sep 17 00:00:00 2001 From: "Quynh Nguyen (Quinn)" <43350163+qn895@users.noreply.github.com> Date: Wed, 23 Aug 2023 13:57:24 -0500 Subject: [PATCH] [ML] Fix continuous with the latest function transform test (#164497) (cherry picked from commit e651a6f87599d1bba72e9ebecf5e5c16979c4571) --- .../index_pattern/continuous_transform.ts | 24 +++++++++++++++++-- .../test/functional/services/transform/api.ts | 16 ++++++++----- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/x-pack/test/functional/apps/transform/creation/index_pattern/continuous_transform.ts b/x-pack/test/functional/apps/transform/creation/index_pattern/continuous_transform.ts index 648f7f8ccc04..0fed167afb83 100644 --- a/x-pack/test/functional/apps/transform/creation/index_pattern/continuous_transform.ts +++ b/x-pack/test/functional/apps/transform/creation/index_pattern/continuous_transform.ts @@ -7,6 +7,7 @@ import { TRANSFORM_STATE } from '@kbn/transform-plugin/common/constants'; +import type { MappingTypeMapping } from '@elastic/elasticsearch/lib/api/types'; import type { FtrProviderContext } from '../../../../ftr_provider_context'; import { GroupByEntry, @@ -224,8 +225,27 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { ]; for (const testData of testDataList) { - // FLAKY: https://github.com/elastic/kibana/issues/158612 - describe.skip(`${testData.suiteTitle}`, function () { + describe(`${testData.suiteTitle}`, function () { + before(async () => { + // Add explicit mapping for destination index https://github.com/elastic/elasticsearch/issues/67148 + if (testData.type === 'latest') { + const destIndexMappings: MappingTypeMapping = { + properties: { + products: { + properties: { + base_price: { + type: 'float', + }, + }, + }, + }, + }; + + await transform.api.createIndices(testData.destinationIndex, { + mappings: destIndexMappings, + }); + } + }); after(async () => { await transform.api.deleteIndices(testData.destinationIndex); await transform.testResources.deleteIndexPatternByTitle(testData.destinationIndex); diff --git a/x-pack/test/functional/services/transform/api.ts b/x-pack/test/functional/services/transform/api.ts index 8fb984e72e0c..5aad29fff894 100644 --- a/x-pack/test/functional/services/transform/api.ts +++ b/x-pack/test/functional/services/transform/api.ts @@ -11,10 +11,11 @@ import type { PutTransformsRequestSchema } from '@kbn/transform-plugin/common/ap import { TransformState, TRANSFORM_STATE } from '@kbn/transform-plugin/common/constants'; import type { TransformStats } from '@kbn/transform-plugin/common/types/transform_stats'; -import { GetTransformsResponseSchema } from '@kbn/transform-plugin/common/api_schemas/transforms'; -import { PostTransformsUpdateRequestSchema } from '@kbn/transform-plugin/common/api_schemas/update_transforms'; -import { TransformPivotConfig } from '@kbn/transform-plugin/common/types/transform'; -import { FtrProviderContext } from '../../ftr_provider_context'; +import type { GetTransformsResponseSchema } from '@kbn/transform-plugin/common/api_schemas/transforms'; +import type { PostTransformsUpdateRequestSchema } from '@kbn/transform-plugin/common/api_schemas/update_transforms'; +import type { TransformPivotConfig } from '@kbn/transform-plugin/common/types/transform'; +import type { IndicesCreateRequest } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import type { FtrProviderContext } from '../../ftr_provider_context'; export async function asyncForEach(array: any[], callback: Function) { for (let index = 0; index < array.length; index++) { @@ -39,14 +40,17 @@ export function TransformAPIProvider({ getService }: FtrProviderContext) { ); }, - async createIndices(indices: string) { + async createIndices( + indices: string, + params: IndicesCreateRequest['body'] = {} as NonNullable + ) { log.debug(`Creating indices: '${indices}'...`); if ((await es.indices.exists({ index: indices, allow_no_indices: false })) === true) { log.debug(`Indices '${indices}' already exist. Nothing to create.`); return; } - const createResponse = await es.indices.create({ index: indices }); + const createResponse = await es.indices.create({ index: indices, ...params }); expect(createResponse) .to.have.property('acknowledged') .eql(true, 'Response for create request indices should be acknowledged.');