kibana/x-pack/test
Ryland Herrick b5ae056ac4
[Security Solution][Detections] ML Rules accept multiple ML Job IDs (#97073)
* Adds helper to normalize legacy ML rule field to an array

This will be used on read of rules, to normalize legacy rules while
avoiding an explicit migration.

* Fix our detection-specific ML search function

Luckily this was just a translation layer to our anomaly call, and the
underlying functions already accepted an array of strings.

* WIP: Run rules against multiple ML Job IDs

We don't yet support creation of rules with multiple job ids, either on
the API or the UI, but when we do they will work.

Note: the logic was previously to generate an error if the underlying
job was not running, but to still query and generate alerts. Extending
that logic to multiple jobs: if any are not running, we generate an
error but continue querying and generating alerts.

* WIP: updating ml rule schemas to support multiple job IDs

* Simplify normalization method

We don't care about null or empty string values here; those were
holdovers from copying the logic of normalizeThreshold and don't apply
to this situation.

* Move normalized types to separate file to fix circular dependency

Our use of NonEmptyArray within common/schemas seemed to be causing the
above; this fixes it for now.

* Normalize ML job_ids param at the API layer

Previous changes to the base types already covered the majority of
routes; this updates the miscellaneous helpers that don't leverage those
shared utilities.

At the DB level, the forthcoming migration will ensure that we always
have "normalized" job IDs as an array.

* Count stopped ML Jobs as partial failure during ML Rule execution

Since we continue to query anomalies and potentially generate alerts, a
"failure" status is no longer the most accurate for this situation.

* Update 7.13 alerts migration to allow multi-job ML Rules

This ensures that we can assume string[] for this field during rule
execution.

* Display N job statuses on rule details

* WIP: converts MLJobSelect to a multiselect

Unfortunately, the SuperSelect does not allow multiselect so we need to
convert this to a combobox. Luckily we can reuse most of the code here
and remain relatively clean.

Since all combobox options must be the same (fixed) height, we're
somewhat more limited than before for displaying the rows. The
truncation appears fine, but I need to figure out a way to display the
full description as well.

* Update client-side logic to handle an array of ML job_ids

* Marginally more legible error message

* Conditionally call our normalize helper only if we have a value

This fixes a type error where TS could not infer that the return value
would not be undefined despite knowing that the argument was never
undefined. I tried some fancy conditional generic types, but that didn't
work.

This is more analogous to normalizeThresholdObject now, anyway.

* Fix remaining type error

* Clean up our ML executor tests with existing contract mocks

* Update ML Executor tests with new logic

We now record a partial failure instead of an error.

* Add and update tests for new ML normalization logic

* Add and update integration tests for ML Rules

Ensures that dealing with legacy job formats continues to work in the
API.

* Fix a type error

These params can no longer be strings.

* Update ML cypress test to create a rule with 2 ML jobs

If we can create a rule with 2 jobs, we should also be able to create a
rule with 1 job.

* Remove unused constant

* Persist a partial failure message written by a rule executor

We added the result.warning field as a way to indicate that a partial
failure was written to the rule, but neglected to account for that in the
main rule execution code, which caused a success status to immediately
overwrite the partial failure if the rule execution did not otherwise
fail/short-circuit.
2021-04-15 21:27:43 -05:00
..
accessibility unskip accessibility - dashboard_edit_panel tests (#96710) 2021-04-14 15:05:12 -07:00
alerting_api_integration Fix alerting flaky test by adding retryIfConflict to fixture APIs (#96226) 2021-04-13 13:29:22 -04:00
api_integration [Security Solutions ] Fixes failed to query DNS data - too_many_buckets_exception (#97069) 2021-04-15 09:22:56 -06:00
api_integration_basic Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
apm_api_integration [RAC] Populate Observability alerts table with data from alerts indices (#96692) 2021-04-15 18:25:50 +02:00
banners_functional add per space configuration to custom header banner (#94449) 2021-03-31 10:57:06 +02:00
case_api_integration [Cases] Fix _find API total bug (#95235) 2021-03-26 08:46:07 -04:00
common Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
detection_engine_api_integration [Security Solution][Detections] ML Rules accept multiple ML Job IDs (#97073) 2021-04-15 21:27:43 -05:00
encrypted_saved_objects_api_integration Migrate away from legacyEs service in tests. (#95402) 2021-03-26 18:49:19 +01:00
endpoint_api_integration_no_ingest Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
examples chore(NA): enable preserve symlinks for ts without breaking packages development (#95433) 2021-03-31 00:02:22 +01:00
fleet_api_integration [Fleet] Use 'hosted agent policy' naming in UI & API messages (#97287) 2021-04-15 21:01:28 -04:00
fleet_functional [Fleet] Bootstrap functional test suite (#91898) 2021-02-18 16:34:50 -05:00
functional [Fleet] Remove fleet agent routes and related services (#97206) 2021-04-15 17:15:43 -04:00
functional_basic [ML] Fix import missing range for File Data Visualizer, Discover card visible when disabled, texts (#91352) 2021-02-16 16:05:01 +01:00
functional_cors chore(NA): enable preserve symlinks for ts without breaking packages development (#95433) 2021-03-31 00:02:22 +01:00
functional_embedded [Plugins Discovery] Enforce camelCase plugin IDs (#90752) 2021-02-11 14:36:17 +00:00
functional_enterprise_search [App Search] Add delete action to EnginesTable component (#92844) 2021-03-09 09:49:52 -05:00
functional_vis_wizard Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
functional_with_es_ssl [Alerting] Preconfigured alert history index connector (#94909) 2021-04-08 18:18:44 -04:00
licensing_plugin chore(NA): enable preserve symlinks for ts without breaking packages development (#95433) 2021-03-31 00:02:22 +01:00
lists_api_integration ES client : use the new type definitions (#83808) 2021-03-25 04:47:16 -04:00
load [loa testing] wait 60 sec b/w simulations (#96612) 2021-04-08 23:07:08 +02:00
observability_api_integration ES client : use the new type definitions (#83808) 2021-03-25 04:47:16 -04:00
plugin_api_integration [Event Log] Extend ECS event schema with fields needed for Detection Engine (#95067) 2021-03-29 14:59:36 +02:00
plugin_api_perf [Plugins Discovery] Enforce camelCase plugin IDs (#90752) 2021-02-11 14:36:17 +00:00
plugin_functional [Security Solution][RAC][Timeline] Timeline plugin skeleton and test plugin harness (#95683) 2021-03-31 15:33:19 -04:00
reporting_api_integration Reporting: Refactor functional tests with security roles checks (#96856) 2021-04-14 09:20:59 -07:00
reporting_functional Reporting: Refactor functional tests with security roles checks (#96856) 2021-04-14 09:20:59 -07:00
saved_object_api_integration Migrate away from legacyEs service in tests. (#95402) 2021-03-26 18:49:19 +01:00
saved_object_tagging skip flaky suite (#89958) 2021-02-17 06:55:11 -08:00
saved_objects_field_count Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
search_sessions_integration [Search Sessions] Rename search sessions functional tests. Remove wip mention (#95330) 2021-03-26 18:08:46 +01:00
security_api_integration chore(NA): enable preserve symlinks for ts without breaking packages development (#95433) 2021-03-31 00:02:22 +01:00
security_functional Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
security_solution_cypress [Security Solution][Detections] Improves indicator match Cypress tests (#94913) 2021-03-25 19:25:49 +01:00
security_solution_endpoint [Fleet] Remove fleet agent routes and related services (#97206) 2021-04-15 17:15:43 -04:00
security_solution_endpoint_api_int [Fleet] Remove fleet agent routes and related services (#97206) 2021-04-15 17:15:43 -04:00
security_solution_ftr/page_objects/detections Add a11y test coverage to Rule Creation Flow for Detections tab (#94377) 2021-03-25 15:05:23 -04:00
spaces_api_integration skip flaky suite (#92358) 2021-03-29 13:11:33 +01:00
stack_functional_integration ccs_discover additional tests (#96669) 2021-04-12 12:23:46 -07:00
ui_capabilities [Plugins Discovery] Enforce camelCase plugin IDs (#90752) 2021-02-11 14:36:17 +00:00
upgrade Fix reporting test (#95586) 2021-03-26 16:33:29 -06:00
upgrade_assistant_integration Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
usage_collection [Plugins Discovery] Enforce camelCase plugin IDs (#90752) 2021-02-11 14:36:17 +00:00
visual_regression Elastic License 2.0 (#90099) 2021-02-03 18:12:39 -08:00
tsconfig.json Merge tsconfig and x-pack/tsconfig files (#94519) 2021-03-16 15:13:49 +01:00