kibana/x-pack/test/api_integration/apis/ml/index.ts
Walter Rafelsberger 71e7f5ae55
[ML] Anomaly Detection: Use data view esTypes instead of custom field caps wrapper endpoint. (#182588)
## Summary

Fixes #182514.

The links menu for the anomalies table used a custom field caps wrapper
API endpoint to identify the type of the categorization field. This PR
changes this to use the data view API instead to use `esTypes` for the
same check. This allows us to remove the custom field caps API endpoint
completely.

Removes the route `POST /internal/ml/indices/field_caps` as it is no
longer required by the ml plugin.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
2024-05-10 07:40:00 +02:00

77 lines
4.1 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService, loadTestFile }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const ml = getService('ml');
describe('Machine Learning', function () {
this.tags(['ml']);
before(async () => {
await ml.securityCommon.createMlRoles();
await ml.securityCommon.createMlUsers();
// ML saved objects (e.g. lang_ident_model_1) might have lost the * space
// assignment when privious test suites loaded and unloaded the .kibana index.
// We're making sure that it's in the expected state again.
await ml.api.initSavedObjects();
});
after(async () => {
await ml.securityCommon.cleanMlUsers();
await ml.securityCommon.cleanMlRoles();
await esArchiver.unload('x-pack/test/functional/es_archives/ml/ecommerce');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/categorization');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/categorization_small');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_apache');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_auditbeat');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_apm_transaction');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_heartbeat');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_logs');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_nginx');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_sample_ecommerce');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_sample_logs');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_security_endpoint');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_security_auditbeat');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_security_packetbeat');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_security_winlogbeat');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/farequote');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/bm_classification');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/ihp_outlier');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_metricbeat');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_security_cloudtrail');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_metrics_ui');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_apache_data_stream');
await esArchiver.unload('x-pack/test/functional/es_archives/ml/module_nginx_data_stream');
await ml.testResources.resetKibanaTimeZone();
});
loadTestFile(require.resolve('./annotations'));
loadTestFile(require.resolve('./anomaly_detectors'));
loadTestFile(require.resolve('./calendars'));
loadTestFile(require.resolve('./datafeeds'));
loadTestFile(require.resolve('./data_frame_analytics'));
loadTestFile(require.resolve('./fields_service'));
loadTestFile(require.resolve('./filters'));
loadTestFile(require.resolve('./job_validation'));
loadTestFile(require.resolve('./job_audit_messages'));
loadTestFile(require.resolve('./jobs'));
loadTestFile(require.resolve('./management'));
loadTestFile(require.resolve('./modules'));
loadTestFile(require.resolve('./results'));
loadTestFile(require.resolve('./saved_objects'));
loadTestFile(require.resolve('./system'));
loadTestFile(require.resolve('./trained_models'));
loadTestFile(require.resolve('./notifications'));
loadTestFile(require.resolve('./model_management'));
});
}