@@ -13,12 +13,12 @@ import { FtrProviderContext } from '../../../../../common/ftr_provider_context';
1313// eslint-disable-next-line import/no-default-export
1414export default function createAlertsAsDataInstallResourcesTest ( { getService } : FtrProviderContext ) {
1515 const es = getService ( 'es' ) ;
16+ const retry = getService ( 'retry' ) ;
1617 const frameworkMappings = mappingFromFieldMap ( alertFieldMap , 'strict' ) ;
1718 const legacyAlertMappings = mappingFromFieldMap ( legacyAlertFieldMap , 'strict' ) ;
1819 const ecsMappings = mappingFromFieldMap ( ecsFieldMap , 'strict' ) ;
1920
20- // Failing: See https://github.com/elastic/kibana/issues/181296
21- describe . skip ( 'install alerts as data resources' , ( ) => {
21+ describe ( 'install alerts as data resources' , ( ) => {
2222 it ( 'should install common alerts as data resources on startup' , async ( ) => {
2323 const ilmPolicyName = '.alerts-ilm-policy' ;
2424 const frameworkComponentTemplateName = '.alerts-framework-mappings' ;
@@ -174,42 +174,43 @@ export default function createAlertsAsDataInstallResourcesTest({ getService }: F
174174 } ,
175175 } ) ;
176176
177- const contextIndex = await es . indices . get ( {
178- index : indexName ,
179- } ) ;
180-
181- expect ( contextIndex [ indexName ] . aliases ) . to . eql ( {
182- '.alerts-test.patternfiring.alerts-default' : {
183- is_write_index : true ,
184- } ,
185- } ) ;
186- expect ( contextIndex [ indexName ] . mappings ?. _meta ?. managed ) . to . eql ( true ) ;
187- expect ( contextIndex [ indexName ] . mappings ?. _meta ?. namespace ) . to . eql ( 'default' ) ;
188- expect ( contextIndex [ indexName ] . mappings ?. _meta ?. kibana ?. version ) . to . be . a ( 'string' ) ;
189- expect ( contextIndex [ indexName ] . mappings ?. dynamic ) . to . eql ( 'false' ) ;
190- expect ( contextIndex [ indexName ] . mappings ?. properties ) . to . eql ( {
191- ...contextSpecificMappings ,
192- ...frameworkMappings . properties ,
193- } ) ;
194-
195- expect ( contextIndex [ indexName ] . settings ?. index ?. lifecycle ) . to . eql ( {
196- name : '.alerts-ilm-policy' ,
197- rollover_alias : '.alerts-test.patternfiring.alerts-default' ,
198- } ) ;
177+ await retry . try ( async ( ) => {
178+ const contextIndex = await es . indices . get ( {
179+ index : indexName ,
180+ } ) ;
181+ expect ( contextIndex [ indexName ] . aliases ) . to . eql ( {
182+ '.alerts-test.patternfiring.alerts-default' : {
183+ is_write_index : true ,
184+ } ,
185+ } ) ;
186+ expect ( contextIndex [ indexName ] . mappings ?. _meta ?. managed ) . to . eql ( true ) ;
187+ expect ( contextIndex [ indexName ] . mappings ?. _meta ?. namespace ) . to . eql ( 'default' ) ;
188+ expect ( contextIndex [ indexName ] . mappings ?. _meta ?. kibana ?. version ) . to . be . a ( 'string' ) ;
189+ expect ( contextIndex [ indexName ] . mappings ?. dynamic ) . to . eql ( 'false' ) ;
190+ expect ( contextIndex [ indexName ] . mappings ?. properties ) . to . eql ( {
191+ ...contextSpecificMappings ,
192+ ...frameworkMappings . properties ,
193+ } ) ;
194+
195+ expect ( contextIndex [ indexName ] . settings ?. index ?. lifecycle ) . to . eql ( {
196+ name : '.alerts-ilm-policy' ,
197+ rollover_alias : '.alerts-test.patternfiring.alerts-default' ,
198+ } ) ;
199+
200+ expect ( contextIndex [ indexName ] . settings ?. index ?. mapping ) . to . eql ( {
201+ ignore_malformed : 'true' ,
202+ total_fields : {
203+ limit : '2500' ,
204+ } ,
205+ } ) ;
199206
200- expect ( contextIndex [ indexName ] . settings ?. index ?. mapping ) . to . eql ( {
201- ignore_malformed : 'true' ,
202- total_fields : {
203- limit : '2500' ,
204- } ,
207+ expect ( contextIndex [ indexName ] . settings ?. index ?. hidden ) . to . eql ( 'true' ) ;
208+ expect ( contextIndex [ indexName ] . settings ?. index ?. number_of_shards ) . to . eql ( 1 ) ;
209+ expect ( contextIndex [ indexName ] . settings ?. index ?. auto_expand_replicas ) . to . eql ( '0-1' ) ;
210+ expect ( contextIndex [ indexName ] . settings ?. index ?. provided_name ) . to . eql (
211+ '.internal.alerts-test.patternfiring.alerts-default-000001'
212+ ) ;
205213 } ) ;
206-
207- expect ( contextIndex [ indexName ] . settings ?. index ?. hidden ) . to . eql ( 'true' ) ;
208- expect ( contextIndex [ indexName ] . settings ?. index ?. number_of_shards ) . to . eql ( 1 ) ;
209- expect ( contextIndex [ indexName ] . settings ?. index ?. auto_expand_replicas ) . to . eql ( '0-1' ) ;
210- expect ( contextIndex [ indexName ] . settings ?. index ?. provided_name ) . to . eql (
211- '.internal.alerts-test.patternfiring.alerts-default-000001'
212- ) ;
213214 } ) ;
214215 } ) ;
215216}
0 commit comments