Skip to content

Commit 77140f5

Browse files
committed
fix: add some time before cancel
1 parent 606e24f commit 77140f5

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

tests/job-client.test.js

+20-3
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,26 @@ test(
115115
}
116116
)
117117
.then(
118-
(jobIdentifier)=>{
119-
logger.debug(`testCancelJob :: canceling job :: ${jobIdentifier}`);
120-
return jobClient.cancelJob(jobIdentifier);
118+
(jobIdentifier) => {
119+
return new Promise(
120+
(resolve, reject) => {
121+
setTimeout(
122+
() => {
123+
resolve(jobClient.getJob(jobIdentifier));
124+
},
125+
5000
126+
);
127+
}
128+
);
129+
}
130+
)
131+
.then(
132+
(job)=>{
133+
if( job.status != "COMPLETED" ){
134+
logger.debug(`testCancelJob :: canceling job :: ${job.jobIdentifier}`);
135+
return jobClient.cancelJob(job.jobIdentifier);
136+
}
137+
return job;
121138
}
122139
)
123140
.then(

0 commit comments

Comments
 (0)