mirror of
https://github.com/elastic/kibana.git
synced 2025-06-29 03:24:45 -04:00
## Summary Resolves: https://github.com/elastic/kibana/issues/192201 - Expose `TryWithRetriesOptions` - Tune timeouts to pass ci - Add attempt count debug info to `retry/retry_for_success.ts` - Helps with tuning timeout params - Move exposure of `AlertingApiProvider` from `x-pack/test_serverless/api_integration/services/index.ts` -> `x-pack/test_serverless/shared/services/deployment_agnostic_services.ts` - This exposes the alerting api under Deployment Agnostic Services (DA), and DA is exposed within `x-pack/test_serverless/functional/services/index.ts` (Shared Services [Serverless]) - Collapse helper script functions into just another object literal stanza within `AlertingApiProvider` - Update all references - Refactor alerting api to use `retry` service, instead of p-retry (following [this pr](https://github.com/elastic/kibana/pull/178660)) ### Additional debug logging Run in debug mode (add `-v`): ``` node scripts/functional_tests \ --config x-pack/test_serverless/api_integration/test_suites/search/common_configs/config.group1.ts \ --grep "Summary actions" -v ``` #### After ``` │ sill retry.tryWithRetries('Alerting API - waitForDocumentInIndex, retryOptions: {"retryCount":5,"retryDelay":200}', [object AsyncFunction], [object Object]) │ debg --- retry.tryWithRetries error: index_not_found_exception │ Root causes: │ index_not_found_exception: no such index [alert-action-es-query] - Attempt #: 1 │ sill es.search([object Object]) │ debg --- retry.tryWithRetries failed again with the same message... - Attempt #: 2 │ sill es.search([object Object]) │ debg --- retry.tryWithRetries failed again with the same message... - Attempt #: 3 │ sill es.search([object Object]) │ debg --- retry.tryWithRetries failed again with the same message... - Attempt #: 4 │ sill es.search([object Object]) │ debg --- retry.tryWithRetries failed again with the same message... - Attempt #: 5 ... // Msg after all attempts fail: │ Error: retry.tryWithRetries reached the limit of attempts waiting for 'Alerting API - waitForDocumentInIndex, retryOptions: {"retryCount":5,"retryDelay":200}': 5 out of 5 │ ResponseError: index_not_found_exception │ Root causes: │ index_not_found_exception: no such index [alert-action-es-query] │ at SniffingTransport._request (node_modules/@elastic/transport/src/Transport.ts:601:17) │ at processTicksAndRejections (node:internal/process/task_queues:95:5) │ at /Users/trezworkbox/dev/main.worktrees/cleanup-alerting-api/node_modules/@elastic/transport/src/Transport.ts:704:22 │ at SniffingTransport.request (node_modules/@elastic/transport/src/Transport.ts:701:14) │ at Proxy.SearchApi (node_modules/@elastic/elasticsearch/src/api/api/search.ts:96:10) │ at alerting_api.ts:123:28 │ at runAttempt (retry_for_success.ts:30:15) │ at retryForSuccess (retry_for_success.ts:99:21) │ at Proxy.tryWithRetries (retry.ts:113:12) │ at Object.waitForDocumentInIndex (alerting_api.ts:120:14) │ at Context.<anonymous> (summary_actions.ts:146:20) │ at Object.apply (wrap_function.js:74:16) │ at Object.apply (wrap_function.js:74:16) │ at onFailure (retry_for_success.ts:18:9) │ at retryForSuccess (retry_for_success.ts:75:7) │ at Proxy.tryWithRetries (retry.ts:113:12) │ at Object.waitForDocumentInIndex (alerting_api.ts:120:14) │ at Context.<anonymous> (summary_actions.ts:146:20) │ at Object.apply (wrap_function.js:74:16) │ at Object.apply (wrap_function.js:74:16) ``` ### Notes Was put back in draft to additional scope detailed in issue linked above. --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
63 lines
2.7 KiB
TypeScript
63 lines
2.7 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 { GenericFtrProviderContext } from '@kbn/test';
|
|
import { services as deploymentAgnosticSharedServices } from '../../shared/services/deployment_agnostic_services';
|
|
import { services as svlSharedServices } from '../../shared/services';
|
|
|
|
import { SamlToolsProvider } from './saml_tools';
|
|
import { SvlCasesServiceProvider } from './svl_cases';
|
|
import { SloApiProvider } from './slo_api';
|
|
import { TransformProvider } from './transform';
|
|
|
|
import { SvlEnrichPoliciesApi } from './index_management/svl_enrich_policies.api';
|
|
import { SvlSettingsApi } from './index_management/svl_settings.api';
|
|
import { SvlIndicesApi } from './index_management/svl_indices.api';
|
|
import { SvlIndicesHelpers } from './index_management/svl_indices.helpers';
|
|
import { SvlEnrichPoliciesHelpers } from './index_management/svl_enrich_policies.helpers';
|
|
import { SvlDatastreamsHelpers } from './index_management/svl_datastreams.helpers';
|
|
import { SvlComponentTemplatesApi } from './index_management/svl_component_templates.api';
|
|
import { SvlComponentTemplateHelpers } from './index_management/svl_component_templates.helpers';
|
|
import { SvlTemplatesHelpers } from './index_management/svl_templates.helpers';
|
|
import { SvlTemplatesApi } from './index_management/svl_templates.api';
|
|
import { SvlMappingsApi } from './index_management/svl_mappings.api';
|
|
import { SynthtraceProvider } from './synthtrace';
|
|
import { SvlClusterNodesApi } from './index_management/svl_cluster_nodes.api';
|
|
|
|
export const services = {
|
|
// deployment agnostic FTR services
|
|
...deploymentAgnosticSharedServices,
|
|
|
|
// serverless FTR services
|
|
...svlSharedServices,
|
|
samlTools: SamlToolsProvider,
|
|
svlCases: SvlCasesServiceProvider,
|
|
sloApi: SloApiProvider,
|
|
transform: TransformProvider,
|
|
synthtrace: SynthtraceProvider,
|
|
svlEnrichPoliciesApi: SvlEnrichPoliciesApi,
|
|
svlSettingsApi: SvlSettingsApi,
|
|
svlIndicesApi: SvlIndicesApi,
|
|
svlIndicesHelpers: SvlIndicesHelpers,
|
|
svlEnrichPoliciesHelpers: SvlEnrichPoliciesHelpers,
|
|
svlDatastreamsHelpers: SvlDatastreamsHelpers,
|
|
svlComponentTemplatesApi: SvlComponentTemplatesApi,
|
|
svlComponentTemplateHelpers: SvlComponentTemplateHelpers,
|
|
svlTemplatesHelpers: SvlTemplatesHelpers,
|
|
svlTemplatesApi: SvlTemplatesApi,
|
|
svlMappingsApi: SvlMappingsApi,
|
|
svlClusterNodesApi: SvlClusterNodesApi,
|
|
};
|
|
|
|
export type InheritedFtrProviderContext = GenericFtrProviderContext<typeof services, {}>;
|
|
|
|
export type InheritedServices = InheritedFtrProviderContext extends GenericFtrProviderContext<
|
|
infer TServices,
|
|
{}
|
|
>
|
|
? TServices
|
|
: {};
|