[no-issue] Parallel run e2e and e2e common action refactoring (#4702)

This commit is contained in:
Eugenio Romano
2019-05-13 04:44:35 +02:00
committed by GitHub
parent a48bfc3714
commit 898e3b5a80
288 changed files with 8704 additions and 5130 deletions

View File

@@ -0,0 +1,49 @@
let alfrescoApi = require('@alfresco/js-api');
let program = require('commander');
let MAX_RETRY = 10;
let counter = 0;
let TIMEOUT = 60000;
async function main() {
program
.version('0.1.0')
.option('--host [type]', 'Remote environment host adf.lab.com ')
.option('-p, --password [type]', 'password ')
.option('-u, --username [type]', 'username ')
.parse(process.argv);
await checkEnv();
}
async function checkEnv() {
try {
this.alfrescoJsApi = new alfrescoApi.AlfrescoApiCompatibility({
provider: 'BPM',
hostBpm: program.host
});
await this.alfrescoJsApi.login(program.username, program.password);
} catch (e) {
console.log('Login error environment down or inaccessible');
counter++;
if (MAX_RETRY === counter) {
console.log('Give up');
process.exit(1);
} else {
console.log(`Retry in 1 minute attempt N ${counter}`);
sleep(TIMEOUT);
checkEnv();
}
}
}
function sleep(delay) {
var start = new Date().getTime();
while (new Date().getTime() < start + delay) ;
}
main();