@@ -42,6 +42,14 @@ const outputUriForAdHoc = `gs://${bucketName}/test-output-adhoc/`;
4242const cwd = path . join ( __dirname , '..' ) ;
4343const resourceFile = `testdata/${ testFileName } ` ;
4444
45+ function wait ( ms ) {
46+ return new Promise ( resolve => {
47+ setTimeout ( ( ) => {
48+ return resolve ( ) ;
49+ } , ms ) ;
50+ } ) ;
51+ }
52+
4553before ( async ( ) => {
4654 assert (
4755 process . env . GOOGLE_CLOUD_PROJECT_NUMBER ,
@@ -147,15 +155,15 @@ describe('Job functions preset', () => {
147155 assert . ok ( output . includes ( jobName ) ) ;
148156 } ) ;
149157
150- it ( 'should pause for job to run' , done => {
151- setTimeout ( done , 60000 ) ;
152- } ) ;
153-
154- it ( 'should check that the job succeeded' , function ( ) {
158+ it ( 'should check that the job succeeded' , async function ( ) {
159+ this . retries ( 5 ) ;
160+ await wait ( 30000 ) ;
155161 const output = execSync (
156162 `node getJobState.js ${ projectId } ${ location } ${ this . presetJobId } ` ,
157163 { cwd}
158164 ) ;
165+ // TODO(bcoe): remove this debug information once passing:
166+ console . info ( output . toString ( 'utf8' ) ) ;
159167 assert . ok ( output . includes ( 'Job state: SUCCEEDED' ) ) ;
160168 } ) ;
161169} ) ;
@@ -207,15 +215,15 @@ describe('Job functions template', () => {
207215 assert . ok ( output . includes ( jobName ) ) ;
208216 } ) ;
209217
210- it ( 'should pause for job to run' , done => {
211- setTimeout ( done , 60000 ) ;
212- } ) ;
213-
214- it ( 'should check that the job succeeded' , function ( ) {
218+ it ( 'should check that the job succeeded' , async function ( ) {
219+ this . retries ( 5 ) ;
220+ await wait ( 30000 ) ;
215221 const output = execSync (
216222 `node getJobState.js ${ projectId } ${ location } ${ this . templateJobId } ` ,
217223 { cwd}
218224 ) ;
225+ // TODO(bcoe): remove this debug information once passing:
226+ console . info ( output . toString ( 'utf8' ) ) ;
219227 assert . ok ( output . includes ( 'Job state: SUCCEEDED' ) ) ;
220228 } ) ;
221229} ) ;
@@ -257,15 +265,15 @@ describe('Job functions adhoc', () => {
257265 assert . ok ( output . includes ( jobName ) ) ;
258266 } ) ;
259267
260- it ( 'should pause for job to run' , done => {
261- setTimeout ( done , 60000 ) ;
262- } ) ;
263-
264- it ( 'should check that the job succeeded' , function ( ) {
268+ it ( 'should check that the job succeeded' , async function ( ) {
269+ this . retries ( 5 ) ;
270+ await wait ( 30000 ) ;
265271 const output = execSync (
266272 `node getJobState.js ${ projectId } ${ location } ${ this . adhocJobId } ` ,
267273 { cwd}
268274 ) ;
275+ // TODO(bcoe): remove this debug information once passing:
276+ console . info ( output . toString ( 'utf8' ) ) ;
269277 assert . ok ( output . includes ( 'Job state: SUCCEEDED' ) ) ;
270278 } ) ;
271279} ) ;
0 commit comments