1515'use strict' ;
1616
1717const { assert} = require ( 'chai' ) ;
18- const { describe, it, after } = require ( 'mocha' ) ;
18+ const { describe, it, afterEach } = require ( 'mocha' ) ;
1919const { AutoMlClient} = require ( '@google-cloud/automl' ) . v1 ;
2020
2121const cp = require ( 'child_process' ) ;
@@ -26,11 +26,16 @@ const CREATE_MODEL_REGION_TAG = 'translate_create_model';
2626const LOCATION = 'us-central1' ;
2727const DATASET_ID = 'TRL8522556519449886720' ;
2828
29+ const { delay} = require ( './util' ) ;
30+
2931describe ( 'Automl Translate Create Model Tests' , ( ) => {
3032 const client = new AutoMlClient ( ) ;
3133 let operationId ;
3234
33- it ( 'should create a model' , async ( ) => {
35+ it ( 'should create a model' , async function ( ) {
36+ this . retries ( 5 ) ;
37+ await delay ( this . test ) ;
38+
3439 const projectId = await client . getProjectId ( ) ;
3540 const create_output = execSync (
3641 `node ${ CREATE_MODEL_REGION_TAG } .js ${ projectId } ${ LOCATION } ${ DATASET_ID } translation_test_create_model`
@@ -43,7 +48,7 @@ describe('Automl Translate Create Model Tests', () => {
4348 . split ( '\n' ) [ 0 ] ;
4449 } ) ;
4550
46- after ( 'cancel model training' , async ( ) => {
51+ afterEach ( 'cancel model training' , async ( ) => {
4752 await client . operationsClient . cancelOperation ( { name : operationId } ) ;
4853 } ) ;
4954} ) ;
0 commit comments