15
15
'use strict' ;
16
16
17
17
const { assert} = require ( 'chai' ) ;
18
- const { describe, it, after } = require ( 'mocha' ) ;
18
+ const { describe, it, afterEach } = require ( 'mocha' ) ;
19
19
const { AutoMlClient} = require ( '@google-cloud/automl' ) . v1 ;
20
20
21
21
const cp = require ( 'child_process' ) ;
@@ -26,11 +26,16 @@ const CREATE_MODEL_REGION_TAG = 'translate_create_model';
26
26
const LOCATION = 'us-central1' ;
27
27
const DATASET_ID = 'TRL8522556519449886720' ;
28
28
29
+ const { delay} = require ( './util' ) ;
30
+
29
31
describe ( 'Automl Translate Create Model Tests' , ( ) => {
30
32
const client = new AutoMlClient ( ) ;
31
33
let operationId ;
32
34
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
+
34
39
const projectId = await client . getProjectId ( ) ;
35
40
const create_output = execSync (
36
41
`node ${ CREATE_MODEL_REGION_TAG } .js ${ projectId } ${ LOCATION } ${ DATASET_ID } translation_test_create_model`
@@ -43,7 +48,7 @@ describe('Automl Translate Create Model Tests', () => {
43
48
. split ( '\n' ) [ 0 ] ;
44
49
} ) ;
45
50
46
- after ( 'cancel model training' , async ( ) => {
51
+ afterEach ( 'cancel model training' , async ( ) => {
47
52
await client . operationsClient . cancelOperation ( { name : operationId } ) ;
48
53
} ) ;
49
54
} ) ;
0 commit comments