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

[ML] Fix continuous with the latest function transform test #164497

Merged
merged 1 commit into from
Aug 23, 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
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
16 changes: 10 additions & 6 deletions x-pack/test/functional/services/transform/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -39,14 +40,17 @@ export function TransformAPIProvider({ getService }: FtrProviderContext) {
);
},

async createIndices(indices: string) {
async createIndices(
indices: string,
params: IndicesCreateRequest['body'] = {} as NonNullable<IndicesCreateRequest['body']>
) {
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.');
Expand Down