@@ -7,6 +7,8 @@ import expect from '@kbn/expect';
77
88import type { PutTransformsRequestSchema } from '../../../../plugins/transform/common/api_schemas/transforms' ;
99import type { StopTransformsRequestSchema } from '../../../../plugins/transform/common/api_schemas/stop_transforms' ;
10+ import { isStopTransformsResponseSchema } from '../../../../plugins/transform/common/api_schemas/type_guards' ;
11+
1012import { TRANSFORM_STATE } from '../../../../plugins/transform/common/constants' ;
1113
1214import { COMMON_REQUEST_HEADERS } from '../../../functional/services/ml/common_api' ;
@@ -72,14 +74,14 @@ export default ({ getService }: FtrProviderContext) => {
7274 . send ( reqBody )
7375 . expect ( 200 ) ;
7476
77+ expect ( isStopTransformsResponseSchema ( body ) ) . to . eql ( true ) ;
7578 expect ( body [ transformId ] . success ) . to . eql ( true ) ;
7679 expect ( typeof body [ transformId ] . error ) . to . eql ( 'undefined' ) ;
80+ await transform . api . waitForTransformState ( transformId , TRANSFORM_STATE . STOPPED ) ;
7781 await transform . api . waitForIndicesToExist ( destinationIndex ) ;
7882 } ) ;
7983
8084 it ( 'should return 200 with success:false for unauthorized user' , async ( ) => {
81- await transform . api . waitForTransformStateNotToBe ( transformId , TRANSFORM_STATE . STOPPED ) ;
82-
8385 const reqBody : StopTransformsRequestSchema = [
8486 { id : transformId , state : TRANSFORM_STATE . STARTED } ,
8587 ] ;
@@ -93,6 +95,7 @@ export default ({ getService }: FtrProviderContext) => {
9395 . send ( reqBody )
9496 . expect ( 200 ) ;
9597
98+ expect ( isStopTransformsResponseSchema ( body ) ) . to . eql ( true ) ;
9699 expect ( body [ transformId ] . success ) . to . eql ( false ) ;
97100 expect ( typeof body [ transformId ] . error ) . to . eql ( 'string' ) ;
98101
@@ -116,6 +119,7 @@ export default ({ getService }: FtrProviderContext) => {
116119 . send ( reqBody )
117120 . expect ( 200 ) ;
118121
122+ expect ( isStopTransformsResponseSchema ( body ) ) . to . eql ( true ) ;
119123 expect ( body . invalid_transform_id . success ) . to . eql ( false ) ;
120124 expect ( body . invalid_transform_id ) . to . have . property ( 'error' ) ;
121125 } ) ;
@@ -152,8 +156,11 @@ export default ({ getService }: FtrProviderContext) => {
152156 . send ( reqBody )
153157 . expect ( 200 ) ;
154158
159+ expect ( isStopTransformsResponseSchema ( body ) ) . to . eql ( true ) ;
160+
155161 await asyncForEach ( reqBody , async ( { id : transformId } : { id : string } , idx : number ) => {
156162 expect ( body [ transformId ] . success ) . to . eql ( true ) ;
163+ await transform . api . waitForTransformState ( transformId , TRANSFORM_STATE . STOPPED ) ;
157164 await transform . api . waitForIndicesToExist ( destinationIndices [ idx ] ) ;
158165 } ) ;
159166 } ) ;
@@ -174,8 +181,11 @@ export default ({ getService }: FtrProviderContext) => {
174181 ] )
175182 . expect ( 200 ) ;
176183
184+ expect ( isStopTransformsResponseSchema ( body ) ) . to . eql ( true ) ;
185+
177186 await asyncForEach ( reqBody , async ( { id : transformId } : { id : string } , idx : number ) => {
178187 expect ( body [ transformId ] . success ) . to . eql ( true ) ;
188+ await transform . api . waitForTransformState ( transformId , TRANSFORM_STATE . STOPPED ) ;
179189 await transform . api . waitForIndicesToExist ( destinationIndices [ idx ] ) ;
180190 } ) ;
181191
0 commit comments