@@ -15,6 +15,7 @@ export default ({ getService }: FtrProviderContext) => {
15
15
const supertest = getService ( 'supertestWithoutAuth' ) ;
16
16
const ml = getService ( 'ml' ) ;
17
17
const spacesService = getService ( 'spaces' ) ;
18
+ const retry = getService ( 'retry' ) ;
18
19
19
20
const forecastJobId = 'fq_single_forecast' ;
20
21
const forecastJobDatafeedId = `datafeed-${ forecastJobId } ` ;
@@ -45,21 +46,22 @@ export default ({ getService }: FtrProviderContext) => {
45
46
user : USER ,
46
47
expectedStatusCode : number
47
48
) {
48
- const { body, status } = await supertest
49
- . delete (
50
- `${
51
- space ? `/s/${ space } ` : ''
52
- } /internal/ml/anomaly_detectors/${ jobId } /_forecast/${ forecastId } `
53
- )
54
- . auth ( user , ml . securityCommon . getPasswordForUser ( user ) )
55
- . set ( getCommonRequestHeader ( '1' ) ) ;
56
- ml . api . assertResponseStatusCode ( expectedStatusCode , status , body ) ;
57
-
58
- return body ;
49
+ await retry . tryForTime ( 10000 , async ( ) => {
50
+ const { body, status } = await supertest
51
+ . delete (
52
+ `${
53
+ space ? `/s/${ space } ` : ''
54
+ } /internal/ml/anomaly_detectors/${ jobId } /_forecast/${ forecastId } `
55
+ )
56
+ . auth ( user , ml . securityCommon . getPasswordForUser ( user ) )
57
+ . set ( getCommonRequestHeader ( '1' ) ) ;
58
+ ml . api . assertResponseStatusCode ( expectedStatusCode , status , body ) ;
59
+
60
+ return body ;
61
+ } ) ;
59
62
}
60
63
61
- // Failing see: https://github.com/elastic/kibana/issues/195602
62
- describe . skip ( 'POST anomaly_detectors _forecast with spaces' , function ( ) {
64
+ describe ( 'POST anomaly_detectors _forecast with spaces' , function ( ) {
63
65
let forecastId : string ;
64
66
before ( async ( ) => {
65
67
await esArchiver . loadIfNeeded ( 'x-pack/test/functional/es_archives/ml/farequote' ) ;
@@ -110,11 +112,11 @@ export default ({ getService }: FtrProviderContext) => {
110
112
} ) ;
111
113
112
114
it ( 'should not delete forecast for user without permissions' , async ( ) => {
113
- await await deleteForecast ( forecastJobId , forecastId , idSpace1 , USER . ML_VIEWER , 403 ) ;
115
+ await deleteForecast ( forecastJobId , forecastId , idSpace1 , USER . ML_VIEWER , 403 ) ;
114
116
} ) ;
115
117
116
118
it ( 'should delete forecast for user with permissions' , async ( ) => {
117
- await await deleteForecast ( forecastJobId , forecastId , idSpace1 , USER . ML_POWERUSER , 200 ) ;
119
+ await deleteForecast ( forecastJobId , forecastId , idSpace1 , USER . ML_POWERUSER , 200 ) ;
118
120
} ) ;
119
121
120
122
it ( 'should not run forecast for open job with invalid duration' , async ( ) => {
0 commit comments