@@ -42,6 +42,14 @@ const outputUriForAdHoc = `gs://${bucketName}/test-output-adhoc/`;
42
42
const cwd = path . join ( __dirname , '..' ) ;
43
43
const resourceFile = `testdata/${ testFileName } ` ;
44
44
45
+ function wait ( ms ) {
46
+ return new Promise ( resolve => {
47
+ setTimeout ( ( ) => {
48
+ return resolve ( ) ;
49
+ } , ms ) ;
50
+ } ) ;
51
+ }
52
+
45
53
before ( async ( ) => {
46
54
assert (
47
55
process . env . GOOGLE_CLOUD_PROJECT_NUMBER ,
@@ -147,15 +155,15 @@ describe('Job functions preset', () => {
147
155
assert . ok ( output . includes ( jobName ) ) ;
148
156
} ) ;
149
157
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 ) ;
155
161
const output = execSync (
156
162
`node getJobState.js ${ projectId } ${ location } ${ this . presetJobId } ` ,
157
163
{ cwd}
158
164
) ;
165
+ // TODO(bcoe): remove this debug information once passing:
166
+ console . info ( output . toString ( 'utf8' ) ) ;
159
167
assert . ok ( output . includes ( 'Job state: SUCCEEDED' ) ) ;
160
168
} ) ;
161
169
} ) ;
@@ -207,15 +215,15 @@ describe('Job functions template', () => {
207
215
assert . ok ( output . includes ( jobName ) ) ;
208
216
} ) ;
209
217
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 ) ;
215
221
const output = execSync (
216
222
`node getJobState.js ${ projectId } ${ location } ${ this . templateJobId } ` ,
217
223
{ cwd}
218
224
) ;
225
+ // TODO(bcoe): remove this debug information once passing:
226
+ console . info ( output . toString ( 'utf8' ) ) ;
219
227
assert . ok ( output . includes ( 'Job state: SUCCEEDED' ) ) ;
220
228
} ) ;
221
229
} ) ;
@@ -257,15 +265,15 @@ describe('Job functions adhoc', () => {
257
265
assert . ok ( output . includes ( jobName ) ) ;
258
266
} ) ;
259
267
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 ) ;
265
271
const output = execSync (
266
272
`node getJobState.js ${ projectId } ${ location } ${ this . adhocJobId } ` ,
267
273
{ cwd}
268
274
) ;
275
+ // TODO(bcoe): remove this debug information once passing:
276
+ console . info ( output . toString ( 'utf8' ) ) ;
269
277
assert . ok ( output . includes ( 'Job state: SUCCEEDED' ) ) ;
270
278
} ) ;
271
279
} ) ;
0 commit comments