From 1880e8b3489a609825c8e19683c65ad12b1c35d9 Mon Sep 17 00:00:00 2001 From: Spencer Date: Thu, 12 Jan 2023 15:32:28 -0600 Subject: [PATCH] move code shared with alerting api-integration plugins into a package (#148846) We're working on converting all plugins into packages, which turns almost all code in the repository into a package except for things like the `test` and `x-pack/test` directories. The problem we ran into is that the alerting api-integration test plugins are being migrated to packages but they are currently consuming a handful of helpers from the parent `../lib` directory. This doesn't work, as packages can only import other packages and the `../lib` directory isn't in a package, it's just free-floating `x-pack/test` code. To fix this I've moved the necessary components out of `common/lib` and into `packages/helpers` which is importable via `@kbn/alerting-api-integration-helpers` and updated all the uses to access this new package. --- .github/CODEOWNERS | 1 + package.json | 1 + tsconfig.base.json | 2 ++ .../common/lib/alert_utils.ts | 2 +- .../common/lib/index.ts | 1 - .../actions_simulators/server/simulator.ts | 2 +- .../common/plugins/alerts/server/alert_types.ts | 2 +- .../packages/helpers/README.md | 3 +++ .../helpers}/es_test_index_tool.ts | 1 + .../helpers}/get_proxy_server.ts | 0 .../packages/helpers/index.ts | 9 +++++++++ .../packages/helpers/jest.config.js | 12 ++++++++++++ .../packages/helpers/kibana.jsonc | 6 ++++++ .../packages/helpers/package.json | 6 ++++++ .../packages/helpers/tsconfig.json | 17 +++++++++++++++++ .../actions/connector_types/cases_webhook.ts | 2 +- .../tests/actions/connector_types/jira.ts | 2 +- .../connector_types/oauth_access_token.ts | 2 +- .../tests/actions/connector_types/pagerduty.ts | 2 +- .../tests/actions/connector_types/resilient.ts | 2 +- .../actions/connector_types/servicenow_itom.ts | 2 +- .../actions/connector_types/servicenow_itsm.ts | 2 +- .../actions/connector_types/servicenow_sir.ts | 2 +- .../tests/actions/connector_types/slack.ts | 2 +- .../tests/actions/connector_types/swimlane.ts | 2 +- .../tests/actions/connector_types/webhook.ts | 2 +- .../tests/actions/connector_types/xmatters.ts | 2 +- .../group2/tests/actions/execute.ts | 9 ++------- .../group2/tests/alerting/alerts.ts | 3 +-- .../group2/tests/alerting/excluded.ts | 2 +- .../tests/alerting/get_action_error_log.ts | 9 ++------- .../group2/tests/alerting/health.ts | 10 ++-------- .../group2/tests/alerting/mustache_templates.ts | 2 +- .../group2/tests/alerting/rbac_legacy.ts | 3 ++- .../telemetry/alerting_and_actions_telemetry.ts | 9 ++------- .../security_and_spaces/scenarios.ts | 2 +- .../spaces_only/tests/actions/enqueue.ts | 8 ++------ .../spaces_only/tests/actions/execute.ts | 9 ++------- .../spaces_only/tests/alerting/alerts_base.ts | 3 +-- .../builtin_alert_types/cancellable/rule.ts | 8 ++------ .../circuit_breaker/alert_limit_services.ts | 9 ++------- .../index_threshold_max_alerts.ts | 9 ++------- .../builtin_alert_types/es_query/common.ts | 8 ++------ .../es_query/query_dsl_only.ts | 4 +++- .../builtin_alert_types/es_query/rule.ts | 4 +++- .../index_threshold/alert.ts | 10 +++------- .../index_threshold/fields_endpoint.ts | 4 +++- .../index_threshold/indices_endpoint.ts | 4 +++- .../time_series_query_endpoint.ts | 4 +++- .../builtin_alert_types/lib/create_test_data.ts | 2 +- .../spaces_only/tests/alerting/ephemeral.ts | 10 ++-------- .../spaces_only/tests/alerting/event_log.ts | 9 ++------- .../tests/alerting/get_action_error_log.ts | 9 ++------- .../tests/alerting/get_execution_log.ts | 9 ++------- .../ml_rule_types/anomaly_detection/alert.ts | 8 ++------ .../tests/alerting/monitoring_collection.ts | 2 +- .../transform_health/alert.ts | 8 ++------ x-pack/test/tsconfig.json | 3 +++ yarn.lock | 4 ++++ 59 files changed, 139 insertions(+), 147 deletions(-) create mode 100644 x-pack/test/alerting_api_integration/packages/helpers/README.md rename x-pack/test/alerting_api_integration/{common/lib => packages/helpers}/es_test_index_tool.ts (99%) rename x-pack/test/alerting_api_integration/{common/lib => packages/helpers}/get_proxy_server.ts (100%) create mode 100644 x-pack/test/alerting_api_integration/packages/helpers/index.ts create mode 100644 x-pack/test/alerting_api_integration/packages/helpers/jest.config.js create mode 100644 x-pack/test/alerting_api_integration/packages/helpers/kibana.jsonc create mode 100644 x-pack/test/alerting_api_integration/packages/helpers/package.json create mode 100644 x-pack/test/alerting_api_integration/packages/helpers/tsconfig.json diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index bc136320a03dc..1556638fb5b8a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1086,3 +1086,4 @@ x-pack/packages/ml/nested_property @elastic/ml-ui x-pack/packages/ml/query_utils @elastic/ml-ui x-pack/packages/ml/string_hash @elastic/ml-ui x-pack/packages/ml/url_state @elastic/ml-ui +x-pack/test/alerting_api_integration/packages/helpers @elastic/response-ops diff --git a/package.json b/package.json index 8215ddf2270b7..efcf7bf619968 100644 --- a/package.json +++ b/package.json @@ -748,6 +748,7 @@ "@jest/reporters": "^29.3.1", "@jest/transform": "^29.3.1", "@jest/types": "^29.3.1", + "@kbn/alerting-api-integration-helpers": "link:x-pack/test/alerting_api_integration/packages/helpers", "@kbn/ambient-common-types": "link:packages/kbn-ambient-common-types", "@kbn/ambient-ftr-types": "link:packages/kbn-ambient-ftr-types", "@kbn/ambient-storybook-types": "link:packages/kbn-ambient-storybook-types", diff --git a/tsconfig.base.json b/tsconfig.base.json index 0b30c709b0af3..a9d78e4329626 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -16,6 +16,8 @@ "@kbn/aiops-plugin/*": ["x-pack/plugins/aiops/*"], "@kbn/aiops-utils": ["x-pack/packages/ml/aiops_utils"], "@kbn/aiops-utils/*": ["x-pack/packages/ml/aiops_utils/*"], + "@kbn/alerting-api-integration-helpers": ["x-pack/test/alerting_api_integration/packages/helpers"], + "@kbn/alerting-api-integration-helpers/*": ["x-pack/test/alerting_api_integration/packages/helpers/*"], "@kbn/alerting-example-plugin": ["x-pack/examples/alerting_example"], "@kbn/alerting-example-plugin/*": ["x-pack/examples/alerting_example/*"], "@kbn/alerting-fixture-plugin": ["x-pack/test/functional_with_es_ssl/plugins/alerts"], diff --git a/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts b/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts index 44e2a4c50208e..0a72feee2b9ec 100644 --- a/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts +++ b/x-pack/test/alerting_api_integration/common/lib/alert_utils.ts @@ -5,10 +5,10 @@ * 2.0. */ +import { ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { Space, User } from '../types'; import { ObjectRemover } from './object_remover'; import { getUrlPrefix } from './space_test_utils'; -import { ES_TEST_INDEX_NAME } from './es_test_index_tool'; import { getTestRuleData } from './get_test_rule_data'; export interface AlertUtilsOpts { diff --git a/x-pack/test/alerting_api_integration/common/lib/index.ts b/x-pack/test/alerting_api_integration/common/lib/index.ts index 31cd5991b5e05..2d393f1f7cdb8 100644 --- a/x-pack/test/alerting_api_integration/common/lib/index.ts +++ b/x-pack/test/alerting_api_integration/common/lib/index.ts @@ -7,7 +7,6 @@ export { ObjectRemover } from './object_remover'; export { getUrlPrefix } from './space_test_utils'; -export { ES_TEST_INDEX_NAME, ESTestIndexTool } from './es_test_index_tool'; export { getTestRuleData } from './get_test_rule_data'; export { AlertUtils, diff --git a/x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/simulator.ts b/x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/simulator.ts index 8ff962bdb8927..09afefdaae305 100644 --- a/x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/simulator.ts +++ b/x-pack/test/alerting_api_integration/common/plugins/actions_simulators/server/simulator.ts @@ -8,7 +8,7 @@ import getPort from 'get-port'; import http from 'http'; import httpProxy from 'http-proxy'; -import { getProxyPort } from '../../../lib/get_proxy_server'; +import { getProxyPort } from '@kbn/alerting-api-integration-helpers'; import { getDataFromRequest } from './data_handler'; export interface ProxyArgs { diff --git a/x-pack/test/alerting_api_integration/common/plugins/alerts/server/alert_types.ts b/x-pack/test/alerting_api_integration/common/plugins/alerts/server/alert_types.ts index a3739ca1c990b..b13499e72dbe7 100644 --- a/x-pack/test/alerting_api_integration/common/plugins/alerts/server/alert_types.ts +++ b/x-pack/test/alerting_api_integration/common/plugins/alerts/server/alert_types.ts @@ -18,8 +18,8 @@ import { RuleTypeParams, } from '@kbn/alerting-plugin/server'; import { AlertConsumers } from '@kbn/rule-data-utils'; +import { ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { FixtureStartDeps, FixtureSetupDeps } from './plugin'; -import { ES_TEST_INDEX_NAME } from '../../../lib'; export const EscapableStrings = { escapableBold: '*bold*', diff --git a/x-pack/test/alerting_api_integration/packages/helpers/README.md b/x-pack/test/alerting_api_integration/packages/helpers/README.md new file mode 100644 index 0000000000000..57be9b7bc8b54 --- /dev/null +++ b/x-pack/test/alerting_api_integration/packages/helpers/README.md @@ -0,0 +1,3 @@ +# @kbn/alerting-api-integration-helpers + +A package to hold alerting api-integration test helpers that are shared with the the alerting api-integration plugins. \ No newline at end of file diff --git a/x-pack/test/alerting_api_integration/common/lib/es_test_index_tool.ts b/x-pack/test/alerting_api_integration/packages/helpers/es_test_index_tool.ts similarity index 99% rename from x-pack/test/alerting_api_integration/common/lib/es_test_index_tool.ts rename to x-pack/test/alerting_api_integration/packages/helpers/es_test_index_tool.ts index 2af943785e612..98d69309365e2 100644 --- a/x-pack/test/alerting_api_integration/common/lib/es_test_index_tool.ts +++ b/x-pack/test/alerting_api_integration/packages/helpers/es_test_index_tool.ts @@ -5,6 +5,7 @@ * 2.0. */ import type { Client } from '@elastic/elasticsearch'; + export const ES_TEST_INDEX_NAME = '.kibana-alerting-test-data'; export class ESTestIndexTool { diff --git a/x-pack/test/alerting_api_integration/common/lib/get_proxy_server.ts b/x-pack/test/alerting_api_integration/packages/helpers/get_proxy_server.ts similarity index 100% rename from x-pack/test/alerting_api_integration/common/lib/get_proxy_server.ts rename to x-pack/test/alerting_api_integration/packages/helpers/get_proxy_server.ts diff --git a/x-pack/test/alerting_api_integration/packages/helpers/index.ts b/x-pack/test/alerting_api_integration/packages/helpers/index.ts new file mode 100644 index 0000000000000..9f3523c922306 --- /dev/null +++ b/x-pack/test/alerting_api_integration/packages/helpers/index.ts @@ -0,0 +1,9 @@ +/* + * 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. + */ + +export * from './es_test_index_tool'; +export * from './get_proxy_server'; diff --git a/x-pack/test/alerting_api_integration/packages/helpers/jest.config.js b/x-pack/test/alerting_api_integration/packages/helpers/jest.config.js new file mode 100644 index 0000000000000..752cdf8538093 --- /dev/null +++ b/x-pack/test/alerting_api_integration/packages/helpers/jest.config.js @@ -0,0 +1,12 @@ +/* + * 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. + */ + +module.exports = { + preset: '@kbn/test/jest_node', + rootDir: '../../../../..', + roots: ['/x-pack/test/alerting_api_integration/packages/helpers'], +}; diff --git a/x-pack/test/alerting_api_integration/packages/helpers/kibana.jsonc b/x-pack/test/alerting_api_integration/packages/helpers/kibana.jsonc new file mode 100644 index 0000000000000..0995f28c9c5d6 --- /dev/null +++ b/x-pack/test/alerting_api_integration/packages/helpers/kibana.jsonc @@ -0,0 +1,6 @@ +{ + "type": "test-helper", + "id": "@kbn/alerting-api-integration-helpers", + "owner": "@elastic/response-ops", + "devOnly": true +} diff --git a/x-pack/test/alerting_api_integration/packages/helpers/package.json b/x-pack/test/alerting_api_integration/packages/helpers/package.json new file mode 100644 index 0000000000000..ab6881a816fb4 --- /dev/null +++ b/x-pack/test/alerting_api_integration/packages/helpers/package.json @@ -0,0 +1,6 @@ +{ + "name": "@kbn/alerting-api-integration-helpers", + "private": true, + "version": "1.0.0", + "license": "SSPL-1.0 OR Elastic License 2.0" +} \ No newline at end of file diff --git a/x-pack/test/alerting_api_integration/packages/helpers/tsconfig.json b/x-pack/test/alerting_api_integration/packages/helpers/tsconfig.json new file mode 100644 index 0000000000000..7aba1b1a9378a --- /dev/null +++ b/x-pack/test/alerting_api_integration/packages/helpers/tsconfig.json @@ -0,0 +1,17 @@ +{ + "extends": "../../../../../tsconfig.base.json", + "compilerOptions": { + "outDir": "target/types", + "types": [ + "jest", + "node" + ] + }, + "include": [ + "**/*.ts", + ], + "exclude": [ + "target/**/*" + ], + "kbn_references": [] +} diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/cases_webhook.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/cases_webhook.ts index b89fa5bd03981..f31d365b76c15 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/cases_webhook.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/cases_webhook.ts @@ -8,7 +8,7 @@ import httpProxy from 'http-proxy'; import expect from '@kbn/expect'; -import { getHttpProxyServer } from '../../../../../common/lib/get_proxy_server'; +import { getHttpProxyServer } from '@kbn/alerting-api-integration-helpers'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/jira.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/jira.ts index c4bad232e8ae2..bab622826e0ed 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/jira.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/jira.ts @@ -8,7 +8,7 @@ import httpProxy from 'http-proxy'; import expect from '@kbn/expect'; -import { getHttpProxyServer } from '../../../../../common/lib/get_proxy_server'; +import { getHttpProxyServer } from '@kbn/alerting-api-integration-helpers'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/oauth_access_token.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/oauth_access_token.ts index 4a5bc0a35eaf5..9ed8f220b614d 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/oauth_access_token.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/oauth_access_token.ts @@ -10,8 +10,8 @@ import expect from '@kbn/expect'; import { promisify } from 'util'; import httpProxy from 'http-proxy'; import { KBN_KEY_PATH } from '@kbn/dev-utils'; +import { getHttpProxyServer } from '@kbn/alerting-api-integration-helpers'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; -import { getHttpProxyServer } from '../../../../../common/lib/get_proxy_server'; import { ExternalServiceSimulator, getExternalServiceSimulatorPath, diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/pagerduty.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/pagerduty.ts index 501fd1a7c241d..0b7b99bd9396f 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/pagerduty.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/pagerduty.ts @@ -8,7 +8,7 @@ import httpProxy from 'http-proxy'; import expect from '@kbn/expect'; -import { getHttpProxyServer } from '../../../../../common/lib/get_proxy_server'; +import { getHttpProxyServer } from '@kbn/alerting-api-integration-helpers'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/resilient.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/resilient.ts index d5fa5cf0837b7..0d94903c9a91e 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/resilient.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/resilient.ts @@ -8,7 +8,7 @@ import httpProxy from 'http-proxy'; import expect from '@kbn/expect'; -import { getHttpProxyServer } from '../../../../../common/lib/get_proxy_server'; +import { getHttpProxyServer } from '@kbn/alerting-api-integration-helpers'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/servicenow_itom.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/servicenow_itom.ts index c4657dfd35cd8..b715eba2af799 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/servicenow_itom.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/servicenow_itom.ts @@ -11,7 +11,7 @@ import { asyncForEach } from '@kbn/std'; import getPort from 'get-port'; import http from 'http'; -import { getHttpProxyServer } from '../../../../../common/lib/get_proxy_server'; +import { getHttpProxyServer } from '@kbn/alerting-api-integration-helpers'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { getServiceNowServer } from '../../../../../common/plugins/actions_simulators/server/plugin'; diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/servicenow_itsm.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/servicenow_itsm.ts index fbd731ebb1e26..132f432de3ae6 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/servicenow_itsm.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/servicenow_itsm.ts @@ -11,7 +11,7 @@ import { asyncForEach } from '@kbn/std'; import getPort from 'get-port'; import http from 'http'; -import { getHttpProxyServer } from '../../../../../common/lib/get_proxy_server'; +import { getHttpProxyServer } from '@kbn/alerting-api-integration-helpers'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { getServiceNowServer } from '../../../../../common/plugins/actions_simulators/server/plugin'; diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/servicenow_sir.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/servicenow_sir.ts index 01ac361b457a8..f10af6a9e76f3 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/servicenow_sir.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/servicenow_sir.ts @@ -11,7 +11,7 @@ import { asyncForEach } from '@kbn/std'; import getPort from 'get-port'; import http from 'http'; -import { getHttpProxyServer } from '../../../../../common/lib/get_proxy_server'; +import { getHttpProxyServer } from '@kbn/alerting-api-integration-helpers'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { getServiceNowServer } from '../../../../../common/plugins/actions_simulators/server/plugin'; diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/slack.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/slack.ts index 70e833bf27e82..190be31f811aa 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/slack.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/slack.ts @@ -9,7 +9,7 @@ import httpProxy from 'http-proxy'; import expect from '@kbn/expect'; import http from 'http'; import getPort from 'get-port'; -import { getHttpProxyServer } from '../../../../../common/lib/get_proxy_server'; +import { getHttpProxyServer } from '@kbn/alerting-api-integration-helpers'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { getSlackServer } from '../../../../../common/plugins/actions_simulators/server/plugin'; diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/swimlane.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/swimlane.ts index 4b47ca1860527..0249ff7217101 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/swimlane.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/swimlane.ts @@ -10,7 +10,7 @@ import expect from '@kbn/expect'; import getPort from 'get-port'; import http from 'http'; -import { getHttpProxyServer } from '../../../../../common/lib/get_proxy_server'; +import { getHttpProxyServer } from '@kbn/alerting-api-integration-helpers'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { getSwimlaneServer } from '../../../../../common/plugins/actions_simulators/server/plugin'; diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/webhook.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/webhook.ts index 84fd37bb71944..2566e801404ea 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/webhook.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/webhook.ts @@ -10,7 +10,7 @@ import http from 'http'; import expect from '@kbn/expect'; import { URL, format as formatUrl } from 'url'; import getPort from 'get-port'; -import { getHttpProxyServer } from '../../../../../common/lib/get_proxy_server'; +import { getHttpProxyServer } from '@kbn/alerting-api-integration-helpers'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { getExternalServiceSimulatorPath, diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/xmatters.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/xmatters.ts index 751726adfb248..62c1b935c5289 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/xmatters.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/connector_types/xmatters.ts @@ -8,7 +8,7 @@ import httpProxy from 'http-proxy'; import expect from '@kbn/expect'; -import { getHttpProxyServer } from '../../../../../common/lib/get_proxy_server'; +import { getHttpProxyServer } from '@kbn/alerting-api-integration-helpers'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/execute.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/execute.ts index 35361920cc729..6ee116d3052e2 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/execute.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/actions/execute.ts @@ -7,14 +7,9 @@ import expect from '@kbn/expect'; import { IValidatedEvent, nanosToMillis } from '@kbn/event-log-plugin/server'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { UserAtSpaceScenarios } from '../../../scenarios'; -import { - ESTestIndexTool, - ES_TEST_INDEX_NAME, - getUrlPrefix, - ObjectRemover, - getEventLog, -} from '../../../../common/lib'; +import { getUrlPrefix, ObjectRemover, getEventLog } from '../../../../common/lib'; import { FtrProviderContext } from '../../../../common/ftr_provider_context'; // eslint-disable-next-line import/no-default-export diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/alerts.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/alerts.ts index 1cc8ecf22ab1a..9ddaf8c660d40 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/alerts.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/alerts.ts @@ -11,11 +11,10 @@ import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { IValidatedEvent, nanosToMillis } from '@kbn/event-log-plugin/server'; import { TaskRunning, TaskRunningStage } from '@kbn/task-manager-plugin/server/task_running'; import { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { UserAtSpaceScenarios, Superuser } from '../../../scenarios'; import { FtrProviderContext } from '../../../../common/ftr_provider_context'; import { - ESTestIndexTool, - ES_TEST_INDEX_NAME, getUrlPrefix, getTestRuleData, ObjectRemover, diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/excluded.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/excluded.ts index d09edae045e6f..6c6b9a2ae6795 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/excluded.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/excluded.ts @@ -6,6 +6,7 @@ */ import expect from '@kbn/expect'; +import { ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { UserAtSpaceScenarios } from '../../../scenarios'; import { getTestRuleData, @@ -13,7 +14,6 @@ import { ObjectRemover, getEventLog, AlertUtils, - ES_TEST_INDEX_NAME, } from '../../../../common/lib'; import { FtrProviderContext } from '../../../../common/ftr_provider_context'; diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/get_action_error_log.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/get_action_error_log.ts index ade54c089eaa2..c2e4084fd195c 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/get_action_error_log.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/get_action_error_log.ts @@ -7,14 +7,9 @@ import expect from '@kbn/expect'; +import { ESTestIndexTool } from '@kbn/alerting-api-integration-helpers'; import { Spaces } from '../../../scenarios'; -import { - getUrlPrefix, - ObjectRemover, - getTestRuleData, - getEventLog, - ESTestIndexTool, -} from '../../../../common/lib'; +import { getUrlPrefix, ObjectRemover, getTestRuleData, getEventLog } from '../../../../common/lib'; import { FtrProviderContext } from '../../../../common/ftr_provider_context'; // eslint-disable-next-line import/no-default-export diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/health.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/health.ts index 0663696dbee14..240ca53cb091e 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/health.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/health.ts @@ -6,16 +6,10 @@ */ import expect from '@kbn/expect'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { UserAtSpaceScenarios } from '../../../scenarios'; import { FtrProviderContext } from '../../../../common/ftr_provider_context'; -import { - getUrlPrefix, - getTestRuleData, - ObjectRemover, - AlertUtils, - ESTestIndexTool, - ES_TEST_INDEX_NAME, -} from '../../../../common/lib'; +import { getUrlPrefix, getTestRuleData, ObjectRemover, AlertUtils } from '../../../../common/lib'; // eslint-disable-next-line import/no-default-export export default function createFindTests({ getService }: FtrProviderContext) { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/mustache_templates.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/mustache_templates.ts index f04ac5614f8a6..d012e7d0172e5 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/mustache_templates.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/mustache_templates.ts @@ -18,11 +18,11 @@ import axios from 'axios'; import httpProxy from 'http-proxy'; import expect from '@kbn/expect'; +import { getHttpProxyServer } from '@kbn/alerting-api-integration-helpers'; import { Spaces } from '../../../scenarios'; import { getUrlPrefix, getTestRuleData, ObjectRemover } from '../../../../common/lib'; import { FtrProviderContext } from '../../../../common/ftr_provider_context'; import { getSlackServer } from '../../../../common/plugins/actions_simulators/server/plugin'; -import { getHttpProxyServer } from '../../../../common/lib/get_proxy_server'; // eslint-disable-next-line import/no-default-export export default function executionStatusAlertTests({ getService }: FtrProviderContext) { diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/rbac_legacy.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/rbac_legacy.ts index 30b8fc600e15a..8ce682ac0099e 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/rbac_legacy.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/alerting/rbac_legacy.ts @@ -7,9 +7,10 @@ import expect from '@kbn/expect'; import { SavedObjectsUtils } from '@kbn/core/server'; +import { ESTestIndexTool } from '@kbn/alerting-api-integration-helpers'; import { UserAtSpaceScenarios, Superuser } from '../../../scenarios'; import { FtrProviderContext } from '../../../../common/ftr_provider_context'; -import { ESTestIndexTool, getUrlPrefix, ObjectRemover, AlertUtils } from '../../../../common/lib'; +import { getUrlPrefix, ObjectRemover, AlertUtils } from '../../../../common/lib'; import { setupSpacesAndUsers } from '../../../setup'; // eslint-disable-next-line import/no-default-export diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/telemetry/alerting_and_actions_telemetry.ts b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/telemetry/alerting_and_actions_telemetry.ts index 707f15534e663..324459823d943 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/telemetry/alerting_and_actions_telemetry.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/group2/tests/telemetry/alerting_and_actions_telemetry.ts @@ -6,14 +6,9 @@ */ import expect from '@kbn/expect'; +import { ESTestIndexTool } from '@kbn/alerting-api-integration-helpers'; import { Spaces, Superuser } from '../../../scenarios'; -import { - getUrlPrefix, - getEventLog, - getTestRuleData, - ESTestIndexTool, - TaskManagerDoc, -} from '../../../../common/lib'; +import { getUrlPrefix, getEventLog, getTestRuleData, TaskManagerDoc } from '../../../../common/lib'; import { FtrProviderContext } from '../../../../common/ftr_provider_context'; // eslint-disable-next-line import/no-default-export diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/scenarios.ts b/x-pack/test/alerting_api_integration/security_and_spaces/scenarios.ts index 91d809bff04ca..bfa4968e2e4b5 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/scenarios.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/scenarios.ts @@ -5,8 +5,8 @@ * 2.0. */ +import { ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { Space, User } from '../common/types'; -import { ES_TEST_INDEX_NAME } from '../common/lib'; const NoKibanaPrivileges: User = { username: 'no_kibana_privileges', diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/enqueue.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/enqueue.ts index 9f0eea9d91929..5934543886b16 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/enqueue.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/enqueue.ts @@ -7,13 +7,9 @@ import expect from '@kbn/expect'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { Spaces } from '../../scenarios'; -import { - ESTestIndexTool, - ES_TEST_INDEX_NAME, - getUrlPrefix, - ObjectRemover, -} from '../../../common/lib'; +import { getUrlPrefix, ObjectRemover } from '../../../common/lib'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; // eslint-disable-next-line import/no-default-export diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/execute.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/execute.ts index 40b574063fbe5..f66570fc2655f 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/actions/execute.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/actions/execute.ts @@ -7,14 +7,9 @@ import type { Client } from '@elastic/elasticsearch'; import expect from '@kbn/expect'; import { IValidatedEvent, nanosToMillis } from '@kbn/event-log-plugin/server'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { Spaces } from '../../scenarios'; -import { - ESTestIndexTool, - ES_TEST_INDEX_NAME, - getUrlPrefix, - ObjectRemover, - getEventLog, -} from '../../../common/lib'; +import { getUrlPrefix, ObjectRemover, getEventLog } from '../../../common/lib'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; // eslint-disable-next-line import/no-default-export diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts_base.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts_base.ts index a0f3e48ed9c0e..b1e6ec2b2d458 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts_base.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/alerts_base.ts @@ -12,11 +12,10 @@ import { Response as SupertestResponse } from 'supertest'; import { RecoveredActionGroup } from '@kbn/alerting-plugin/common'; import { TaskRunning, TaskRunningStage } from '@kbn/task-manager-plugin/server/task_running'; import { ConcreteTaskInstance } from '@kbn/task-manager-plugin/server'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { Space } from '../../../common/types'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; import { - ESTestIndexTool, - ES_TEST_INDEX_NAME, getUrlPrefix, getTestRuleData, ObjectRemover, diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/cancellable/rule.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/cancellable/rule.ts index 836e115352624..f8a84727348fb 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/cancellable/rule.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/cancellable/rule.ts @@ -6,15 +6,11 @@ */ import expect from '@kbn/expect'; +import { ESTestIndexTool } from '@kbn/alerting-api-integration-helpers'; import { Spaces } from '../../../../scenarios'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; -import { - ESTestIndexTool, - getUrlPrefix, - ObjectRemover, - getEventLog, -} from '../../../../../common/lib'; +import { getUrlPrefix, ObjectRemover, getEventLog } from '../../../../../common/lib'; import { createEsDocuments } from '../lib/create_test_data'; const RULE_INTERVAL_SECONDS = 6; diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/circuit_breaker/alert_limit_services.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/circuit_breaker/alert_limit_services.ts index 586331503aca9..00b607c102a3a 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/circuit_breaker/alert_limit_services.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/circuit_breaker/alert_limit_services.ts @@ -7,15 +7,10 @@ import expect from '@kbn/expect'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { Spaces } from '../../../../scenarios'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; -import { - ESTestIndexTool, - ES_TEST_INDEX_NAME, - getUrlPrefix, - ObjectRemover, - getEventLog, -} from '../../../../../common/lib'; +import { getUrlPrefix, ObjectRemover, getEventLog } from '../../../../../common/lib'; // eslint-disable-next-line import/no-default-export export default function maxAlertsRuleTests({ getService }: FtrProviderContext) { diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/circuit_breaker/index_threshold_max_alerts.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/circuit_breaker/index_threshold_max_alerts.ts index 49935bbcaf24a..63a5e5283a10b 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/circuit_breaker/index_threshold_max_alerts.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/circuit_breaker/index_threshold_max_alerts.ts @@ -7,15 +7,10 @@ import expect from '@kbn/expect'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { Spaces } from '../../../../scenarios'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; -import { - ESTestIndexTool, - ES_TEST_INDEX_NAME, - getUrlPrefix, - ObjectRemover, - getEventLog, -} from '../../../../../common/lib'; +import { getUrlPrefix, ObjectRemover, getEventLog } from '../../../../../common/lib'; import { createEsDocumentsWithGroups } from '../lib/create_test_data'; const RULE_INTERVAL_SECONDS = 6; diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/common.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/common.ts index d5bd4efeb963b..faca906abc586 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/common.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/common.ts @@ -5,14 +5,10 @@ * 2.0. */ +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; import { Spaces } from '../../../../scenarios'; -import { - ESTestIndexTool, - ES_TEST_INDEX_NAME, - getUrlPrefix, - ObjectRemover, -} from '../../../../../common/lib'; +import { getUrlPrefix, ObjectRemover } from '../../../../../common/lib'; import { createEsDocuments, createEsDocumentsWithGroups } from '../lib/create_test_data'; export const RULE_TYPE_ID = '.es-query'; diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/query_dsl_only.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/query_dsl_only.ts index c30e7bfa9f356..6024d07bccec0 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/query_dsl_only.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/query_dsl_only.ts @@ -7,9 +7,11 @@ import expect from '@kbn/expect'; +import { ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; + import { Spaces } from '../../../../scenarios'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; -import { ES_TEST_INDEX_NAME, getUrlPrefix, ObjectRemover } from '../../../../../common/lib'; +import { getUrlPrefix, ObjectRemover } from '../../../../../common/lib'; import { createDataStream, deleteDataStream } from '../lib/create_test_data'; import { createConnector, diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/rule.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/rule.ts index f43dd10a9f140..6fd81745f770e 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/rule.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/es_query/rule.ts @@ -7,9 +7,11 @@ import expect from '@kbn/expect'; +import { ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; + import { Spaces } from '../../../../scenarios'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; -import { ES_TEST_INDEX_NAME, getUrlPrefix, ObjectRemover } from '../../../../../common/lib'; +import { getUrlPrefix, ObjectRemover } from '../../../../../common/lib'; import { createConnector, ES_GROUPS_TO_WRITE, diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/alert.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/alert.ts index 43a63508e3ca4..945e9f5cd7380 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/alert.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/alert.ts @@ -7,15 +7,11 @@ import expect from '@kbn/expect'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; + import { Spaces } from '../../../../scenarios'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; -import { - ESTestIndexTool, - ES_TEST_INDEX_NAME, - getUrlPrefix, - ObjectRemover, - getEventLog, -} from '../../../../../common/lib'; +import { getUrlPrefix, ObjectRemover, getEventLog } from '../../../../../common/lib'; import { createEsDocumentsWithGroups } from '../lib/create_test_data'; import { createDataStream, deleteDataStream } from '../lib/create_test_data'; diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/fields_endpoint.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/fields_endpoint.ts index 37e71ac0e1a16..48ba628fd788e 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/fields_endpoint.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/fields_endpoint.ts @@ -7,9 +7,11 @@ import expect from '@kbn/expect'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; + import { Spaces } from '../../../../scenarios'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; -import { ESTestIndexTool, ES_TEST_INDEX_NAME, getUrlPrefix } from '../../../../../common/lib'; +import { getUrlPrefix } from '../../../../../common/lib'; const API_URI = 'internal/triggers_actions_ui/data/_fields'; diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/indices_endpoint.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/indices_endpoint.ts index fb70420d5f452..5c6c11d6efd7b 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/indices_endpoint.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/indices_endpoint.ts @@ -7,9 +7,11 @@ import expect from '@kbn/expect'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; + import { Spaces } from '../../../../scenarios'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; -import { ESTestIndexTool, ES_TEST_INDEX_NAME, getUrlPrefix } from '../../../../../common/lib'; +import { getUrlPrefix } from '../../../../../common/lib'; import { createEsDocumentsWithGroups } from '../lib/create_test_data'; import { createDataStream, deleteDataStream } from '../lib/create_test_data'; diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/time_series_query_endpoint.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/time_series_query_endpoint.ts index 61fec5cf7e481..ec342baf3ad66 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/time_series_query_endpoint.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/index_threshold/time_series_query_endpoint.ts @@ -8,9 +8,11 @@ import expect from '@kbn/expect'; import { TimeSeriesQuery } from '@kbn/triggers-actions-ui-plugin/server'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; + import { Spaces } from '../../../../scenarios'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; -import { ESTestIndexTool, ES_TEST_INDEX_NAME, getUrlPrefix } from '../../../../../common/lib'; +import { getUrlPrefix } from '../../../../../common/lib'; import { createEsDocumentsWithGroups } from '../lib/create_test_data'; diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/lib/create_test_data.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/lib/create_test_data.ts index 58df573fa629e..589b70cc2edc5 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/lib/create_test_data.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/builtin_alert_types/lib/create_test_data.ts @@ -7,7 +7,7 @@ import type { Client } from '@elastic/elasticsearch'; import { times } from 'lodash'; import { v4 as uuid } from 'uuid'; -import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '../../../../../common/lib'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; // default end date export const END_DATE = '2020-01-01T00:00:00Z'; diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/ephemeral.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/ephemeral.ts index 008761b3a5d62..26c9829c9ef35 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/ephemeral.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/ephemeral.ts @@ -9,15 +9,9 @@ import expect from '@kbn/expect'; import { flatten } from 'lodash'; import { IValidatedEvent } from '@kbn/event-log-plugin/server'; import { DEFAULT_MAX_EPHEMERAL_ACTIONS_PER_ALERT } from '@kbn/alerting-plugin/server/config'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { Spaces } from '../../scenarios'; -import { - getUrlPrefix, - ObjectRemover, - getTestRuleData, - getEventLog, - ESTestIndexTool, - ES_TEST_INDEX_NAME, -} from '../../../common/lib'; +import { getUrlPrefix, ObjectRemover, getTestRuleData, getEventLog } from '../../../common/lib'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; // eslint-disable-next-line import/no-default-export diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/event_log.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/event_log.ts index 6de49d3d44915..6f1c816feeffd 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/event_log.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/event_log.ts @@ -7,14 +7,9 @@ import expect from '@kbn/expect'; import { IValidatedEvent, nanosToMillis } from '@kbn/event-log-plugin/server'; +import { ESTestIndexTool } from '@kbn/alerting-api-integration-helpers'; import { Spaces } from '../../scenarios'; -import { - getUrlPrefix, - getTestRuleData, - ObjectRemover, - getEventLog, - ESTestIndexTool, -} from '../../../common/lib'; +import { getUrlPrefix, getTestRuleData, ObjectRemover, getEventLog } from '../../../common/lib'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; // eslint-disable-next-line import/no-default-export diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_action_error_log.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_action_error_log.ts index 78d6a09ac41e3..0f2e67b1187fc 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_action_error_log.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_action_error_log.ts @@ -6,15 +6,10 @@ */ import expect from '@kbn/expect'; +import { ESTestIndexTool } from '@kbn/alerting-api-integration-helpers'; import { Spaces } from '../../scenarios'; -import { - getUrlPrefix, - ObjectRemover, - getTestRuleData, - getEventLog, - ESTestIndexTool, -} from '../../../common/lib'; +import { getUrlPrefix, ObjectRemover, getTestRuleData, getEventLog } from '../../../common/lib'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; // eslint-disable-next-line import/no-default-export diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_execution_log.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_execution_log.ts index 984b6bbb832f9..0d2607ad0602b 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_execution_log.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/get_execution_log.ts @@ -6,15 +6,10 @@ */ import expect from '@kbn/expect'; +import { ESTestIndexTool } from '@kbn/alerting-api-integration-helpers'; import { Spaces } from '../../scenarios'; -import { - getUrlPrefix, - ObjectRemover, - getTestRuleData, - getEventLog, - ESTestIndexTool, -} from '../../../common/lib'; +import { getUrlPrefix, ObjectRemover, getTestRuleData, getEventLog } from '../../../common/lib'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; // eslint-disable-next-line import/no-default-export diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/ml_rule_types/anomaly_detection/alert.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/ml_rule_types/anomaly_detection/alert.ts index 1bc267f86f073..51db0e9055faf 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/ml_rule_types/anomaly_detection/alert.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/ml_rule_types/anomaly_detection/alert.ts @@ -12,13 +12,9 @@ import { Datafeed, Job } from '@kbn/ml-plugin/common/types/anomaly_detection_job import { MlAnomalyDetectionAlertParams } from '@kbn/ml-plugin/common/types/alerts'; import { ANOMALY_SCORE_MATCH_GROUP_ID } from '@kbn/ml-plugin/server/lib/alerts/register_anomaly_detection_alert_type'; import { ML_ALERT_TYPES } from '@kbn/ml-plugin/common/constants/alerts'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { Spaces } from '../../../../scenarios'; -import { - ES_TEST_INDEX_NAME, - ESTestIndexTool, - getUrlPrefix, - ObjectRemover, -} from '../../../../../common/lib'; +import { getUrlPrefix, ObjectRemover } from '../../../../../common/lib'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; const ACTION_TYPE_ID = '.index'; diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/monitoring_collection.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/monitoring_collection.ts index 381607361ec42..c6f240b8bb6bd 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/monitoring_collection.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/monitoring_collection.ts @@ -6,13 +6,13 @@ */ import expect from '@kbn/expect'; +import { ESTestIndexTool } from '@kbn/alerting-api-integration-helpers'; import { Spaces } from '../../scenarios'; import { getUrlPrefix, getTestRuleData, ObjectRemover, createWaitForExecutionCount, - ESTestIndexTool, getEventLog, } from '../../../common/lib'; import { FtrProviderContext } from '../../../common/ftr_provider_context'; diff --git a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/transform_rule_types/transform_health/alert.ts b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/transform_rule_types/transform_health/alert.ts index c289be244ed3a..ee432431b7c83 100644 --- a/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/transform_rule_types/transform_health/alert.ts +++ b/x-pack/test/alerting_api_integration/spaces_only/tests/alerting/transform_rule_types/transform_health/alert.ts @@ -7,13 +7,9 @@ import expect from '@kbn/expect'; import { PutTransformsRequestSchema } from '@kbn/transform-plugin/common/api_schemas/transforms'; +import { ESTestIndexTool, ES_TEST_INDEX_NAME } from '@kbn/alerting-api-integration-helpers'; import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; -import { - ES_TEST_INDEX_NAME, - ESTestIndexTool, - getUrlPrefix, - ObjectRemover, -} from '../../../../../common/lib'; +import { getUrlPrefix, ObjectRemover } from '../../../../../common/lib'; import { Spaces } from '../../../../scenarios'; const ACTION_TYPE_ID = '.index'; diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index 133cf885de977..8c353849ed089 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -21,6 +21,8 @@ "exclude": [ "target/**/*", "*/plugins/**/*", + "*/packages/**/*", + "*/*/packages/**/*", ], "kbn_references": [ { "path": "../../test/tsconfig.json" }, @@ -110,5 +112,6 @@ "@kbn/journeys", "@kbn/alerting-fixture-plugin", "@kbn/stdio-dev-helpers", + "@kbn/alerting-api-integration-helpers", ] } diff --git a/yarn.lock b/yarn.lock index a9e11bb7aa0e5..bac27a2bb1ce4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2729,6 +2729,10 @@ version "0.0.0" uid "" +"@kbn/alerting-api-integration-helpers@link:x-pack/test/alerting_api_integration/packages/helpers": + version "0.0.0" + uid "" + "@kbn/alerts@link:packages/kbn-alerts": version "0.0.0" uid ""