From 2ce51474313f3bad457e9a32e33c3bb56d101c48 Mon Sep 17 00:00:00 2001 From: Robert Oskamp Date: Wed, 2 Jun 2021 09:08:21 +0200 Subject: [PATCH] [ML] Functional tests - reenable categorization tests --- .../ml/jobs/categorization_field_examples.ts | 3 +- .../apis/ml/modules/setup_module.ts | 55 ++++---- .../apis/ml/results/get_categorizer_stats.ts | 3 +- .../apis/ml/results/get_stopped_partitions.ts | 3 +- .../apps/ml/anomaly_detection/advanced_job.ts | 133 +++++++++--------- .../anomaly_detection/categorization_job.ts | 3 +- .../functional/services/ml/test_resources.ts | 4 +- 7 files changed, 99 insertions(+), 105 deletions(-) diff --git a/x-pack/test/api_integration/apis/ml/jobs/categorization_field_examples.ts b/x-pack/test/api_integration/apis/ml/jobs/categorization_field_examples.ts index 85072986f1112c..c9adc85b40c1b4 100644 --- a/x-pack/test/api_integration/apis/ml/jobs/categorization_field_examples.ts +++ b/x-pack/test/api_integration/apis/ml/jobs/categorization_field_examples.ts @@ -284,8 +284,7 @@ export default ({ getService }: FtrProviderContext) => { }, ]; - // skipping categorization tests, see https://github.com/elastic/kibana/issues/101056 - describe.skip('Categorization example endpoint - ', function () { + describe('Categorization example endpoint - ', function () { before(async () => { await esArchiver.loadIfNeeded('ml/categorization'); await ml.testResources.setKibanaTimeZoneToUTC(); diff --git a/x-pack/test/api_integration/apis/ml/modules/setup_module.ts b/x-pack/test/api_integration/apis/ml/modules/setup_module.ts index 6df94c35ab50bb..186a87e5473827 100644 --- a/x-pack/test/api_integration/apis/ml/modules/setup_module.ts +++ b/x-pack/test/api_integration/apis/ml/modules/setup_module.ts @@ -241,34 +241,33 @@ export default ({ getService }: FtrProviderContext) => { dashboards: [] as string[], }, }, - // skipping categorization tests, see https://github.com/elastic/kibana/issues/101056 - // { - // testTitleSuffix: - // 'for logs_ui_categories with prefix, startDatafeed true and estimateModelMemory true', - // sourceDataArchive: 'ml/module_logs', - // indexPattern: { name: 'ft_module_logs', timeField: '@timestamp' }, - // module: 'logs_ui_categories', - // user: USER.ML_POWERUSER, - // requestBody: { - // prefix: 'pf7_', - // indexPatternName: 'ft_module_logs', - // startDatafeed: true, - // end: Date.now(), - // }, - // expected: { - // responseCode: 200, - // jobs: [ - // { - // jobId: 'pf7_log-entry-categories-count', - // jobState: JOB_STATE.CLOSED, - // datafeedState: DATAFEED_STATE.STOPPED, - // }, - // ], - // searches: [] as string[], - // visualizations: [] as string[], - // dashboards: [] as string[], - // }, - // }, + { + testTitleSuffix: + 'for logs_ui_categories with prefix, startDatafeed true and estimateModelMemory true', + sourceDataArchive: 'ml/module_logs', + indexPattern: { name: 'ft_module_logs', timeField: '@timestamp' }, + module: 'logs_ui_categories', + user: USER.ML_POWERUSER, + requestBody: { + prefix: 'pf7_', + indexPatternName: 'ft_module_logs', + startDatafeed: true, + end: Date.now(), + }, + expected: { + responseCode: 200, + jobs: [ + { + jobId: 'pf7_log-entry-categories-count', + jobState: JOB_STATE.CLOSED, + datafeedState: DATAFEED_STATE.STOPPED, + }, + ], + searches: [] as string[], + visualizations: [] as string[], + dashboards: [] as string[], + }, + }, { testTitleSuffix: 'for nginx_ecs with prefix, startDatafeed true and estimateModelMemory true', sourceDataArchive: 'ml/module_nginx', diff --git a/x-pack/test/api_integration/apis/ml/results/get_categorizer_stats.ts b/x-pack/test/api_integration/apis/ml/results/get_categorizer_stats.ts index 32a131ded98e18..ef677969d006f0 100644 --- a/x-pack/test/api_integration/apis/ml/results/get_categorizer_stats.ts +++ b/x-pack/test/api_integration/apis/ml/results/get_categorizer_stats.ts @@ -51,8 +51,7 @@ export default ({ getService }: FtrProviderContext) => { query: { bool: { must: [{ match_all: {} }] } }, }; - // skipping categorization tests, see https://github.com/elastic/kibana/issues/101056 - describe.skip('get categorizer_stats', function () { + describe('get categorizer_stats', function () { before(async () => { await esArchiver.loadIfNeeded('ml/module_sample_logs'); await ml.testResources.setKibanaTimeZoneToUTC(); diff --git a/x-pack/test/api_integration/apis/ml/results/get_stopped_partitions.ts b/x-pack/test/api_integration/apis/ml/results/get_stopped_partitions.ts index 97e4800f1bedd8..d00999b06b588c 100644 --- a/x-pack/test/api_integration/apis/ml/results/get_stopped_partitions.ts +++ b/x-pack/test/api_integration/apis/ml/results/get_stopped_partitions.ts @@ -85,8 +85,7 @@ export default ({ getService }: FtrProviderContext) => { const testJobIds = testSetUps.map((t) => t.jobId); - // skipping categorization tests, see https://github.com/elastic/kibana/issues/101056 - describe.skip('get stopped_partitions', function () { + describe('get stopped_partitions', function () { before(async () => { await esArchiver.loadIfNeeded('ml/module_sample_logs'); await ml.testResources.setKibanaTimeZoneToUTC(); diff --git a/x-pack/test/functional/apps/ml/anomaly_detection/advanced_job.ts b/x-pack/test/functional/apps/ml/anomaly_detection/advanced_job.ts index 1ff437d441aa81..bc2f3277206907 100644 --- a/x-pack/test/functional/apps/ml/anomaly_detection/advanced_job.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/advanced_job.ts @@ -149,73 +149,72 @@ export default function ({ getService }: FtrProviderContext) { }, }, }, - // skipping categorization tests, see https://github.com/elastic/kibana/issues/101056 - // { - // suiteTitle: 'with categorization detector and default datafeed settings', - // jobSource: 'ft_ecommerce', - // jobId: `ec_advanced_2_${Date.now()}`, - // get jobIdClone(): string { - // return `${this.jobId}_clone`; - // }, - // jobDescription: - // 'Create advanced job from ft_ecommerce dataset with a categorization detector and default datafeed settings', - // jobGroups: ['automated', 'ecommerce', 'advanced'], - // get jobGroupsClone(): string[] { - // return [...this.jobGroups, 'clone']; - // }, - // pickFieldsConfig: { - // categorizationField: 'products.product_name', - // detectors: [ - // { - // identifier: 'count by mlcategory', - // function: 'count', - // byField: 'mlcategory', - // } as Detector, - // ], - // influencers: ['mlcategory'], - // bucketSpan: '4h', - // memoryLimit: '100mb', - // } as PickFieldsConfig, - // datafeedConfig: {} as DatafeedConfig, - // expected: { - // wizard: { - // timeField: 'order_date', - // }, - // row: { - // recordCount: '4,675', - // memoryStatus: 'ok', - // jobState: 'closed', - // datafeedState: 'stopped', - // latestTimestamp: '2019-07-12 23:45:36', - // }, - // counts: { - // processed_record_count: '4,675', - // processed_field_count: '4,675', - // input_bytes: '354.2 KB', - // input_field_count: '4,675', - // invalid_date_count: '0', - // missing_field_count: '0', - // out_of_order_timestamp_count: '0', - // empty_bucket_count: '0', - // sparse_bucket_count: '0', - // bucket_count: '185', - // earliest_record_timestamp: '2019-06-12 00:04:19', - // latest_record_timestamp: '2019-07-12 23:45:36', - // input_record_count: '4,675', - // latest_bucket_timestamp: '2019-07-12 20:00:00', - // }, - // modelSizeStats: { - // result_type: 'model_size_stats', - // model_bytes_exceeded: '0.0 B', - // // not checking total_by_field_count as the number of categories might change - // total_over_field_count: '0', - // total_partition_field_count: '2', - // bucket_allocation_failures_count: '0', - // memory_status: 'ok', - // timestamp: '2019-07-12 16:00:00', - // }, - // }, - // }, + { + suiteTitle: 'with categorization detector and default datafeed settings', + jobSource: 'ft_ecommerce', + jobId: `ec_advanced_2_${Date.now()}`, + get jobIdClone(): string { + return `${this.jobId}_clone`; + }, + jobDescription: + 'Create advanced job from ft_ecommerce dataset with a categorization detector and default datafeed settings', + jobGroups: ['automated', 'ecommerce', 'advanced'], + get jobGroupsClone(): string[] { + return [...this.jobGroups, 'clone']; + }, + pickFieldsConfig: { + categorizationField: 'products.product_name', + detectors: [ + { + identifier: 'count by mlcategory', + function: 'count', + byField: 'mlcategory', + } as Detector, + ], + influencers: ['mlcategory'], + bucketSpan: '4h', + memoryLimit: '100mb', + } as PickFieldsConfig, + datafeedConfig: {} as DatafeedConfig, + expected: { + wizard: { + timeField: 'order_date', + }, + row: { + recordCount: '4,675', + memoryStatus: 'ok', + jobState: 'closed', + datafeedState: 'stopped', + latestTimestamp: '2019-07-12 23:45:36', + }, + counts: { + processed_record_count: '4,675', + processed_field_count: '4,675', + input_bytes: '354.2 KB', + input_field_count: '4,675', + invalid_date_count: '0', + missing_field_count: '0', + out_of_order_timestamp_count: '0', + empty_bucket_count: '0', + sparse_bucket_count: '0', + bucket_count: '185', + earliest_record_timestamp: '2019-06-12 00:04:19', + latest_record_timestamp: '2019-07-12 23:45:36', + input_record_count: '4,675', + latest_bucket_timestamp: '2019-07-12 20:00:00', + }, + modelSizeStats: { + result_type: 'model_size_stats', + model_bytes_exceeded: '0.0 B', + // not checking total_by_field_count as the number of categories might change + total_over_field_count: '0', + total_partition_field_count: '2', + bucket_allocation_failures_count: '0', + memory_status: 'ok', + timestamp: '2019-07-12 16:00:00', + }, + }, + }, ]; const calendarId = `wizard-test-calendar_${Date.now()}`; diff --git a/x-pack/test/functional/apps/ml/anomaly_detection/categorization_job.ts b/x-pack/test/functional/apps/ml/anomaly_detection/categorization_job.ts index 144199136a6dca..85eeacc58514e2 100644 --- a/x-pack/test/functional/apps/ml/anomaly_detection/categorization_job.ts +++ b/x-pack/test/functional/apps/ml/anomaly_detection/categorization_job.ts @@ -74,8 +74,7 @@ export default function ({ getService }: FtrProviderContext) { const calendarId = `wizard-test-calendar_${Date.now()}`; - // skipping categorization tests, see https://github.com/elastic/kibana/issues/101056 - describe.skip('categorization', function () { + describe('categorization', function () { this.tags(['mlqa']); before(async () => { await esArchiver.loadIfNeeded('ml/categorization'); diff --git a/x-pack/test/functional/services/ml/test_resources.ts b/x-pack/test/functional/services/ml/test_resources.ts index a8db7ccb7a7648..a857809a3079f2 100644 --- a/x-pack/test/functional/services/ml/test_resources.ts +++ b/x-pack/test/functional/services/ml/test_resources.ts @@ -534,7 +534,7 @@ export function MachineLearningTestResourcesProvider({ getService }: FtrProvider }, async installFleetPackage(packageIdentifier: string) { - log.debug(`Installing Fleet package'${packageIdentifier}'`); + log.debug(`Installing Fleet package '${packageIdentifier}'`); await supertest .post(`/api/fleet/epm/packages/${packageIdentifier}`) @@ -545,7 +545,7 @@ export function MachineLearningTestResourcesProvider({ getService }: FtrProvider }, async removeFleetPackage(packageIdentifier: string) { - log.debug(`Removing Fleet package'${packageIdentifier}'`); + log.debug(`Removing Fleet package '${packageIdentifier}'`); await supertest .delete(`/api/fleet/epm/packages/${packageIdentifier}`)