mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
Check remote env if is full before to start the e2e CS (#5024)
* add check remote env full * Update check-cs-env.js
This commit is contained in:
parent
88f9678571
commit
151fef16f4
@ -1,5 +1,7 @@
|
|||||||
let alfrescoApi = require('@alfresco/js-api');
|
let alfrescoApi = require('@alfresco/js-api');
|
||||||
let program = require('commander');
|
let program = require('commander');
|
||||||
|
const path = require('path');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
let MAX_RETRY = 10;
|
let MAX_RETRY = 10;
|
||||||
let counter = 0;
|
let counter = 0;
|
||||||
@ -16,13 +18,14 @@ async function main() {
|
|||||||
|
|
||||||
|
|
||||||
await checkEnv();
|
await checkEnv();
|
||||||
|
await checkDiskSpaceFullEnv();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkEnv() {
|
async function checkEnv() {
|
||||||
try {
|
try {
|
||||||
this.alfrescoJsApi = new alfrescoApi.AlfrescoApiCompatibility({
|
this.alfrescoJsApi = new alfrescoApi.AlfrescoApiCompatibility({
|
||||||
provider: 'ECM',
|
provider: 'ECM',
|
||||||
hostEcm: program.host
|
hostEcm: program.host
|
||||||
});
|
});
|
||||||
|
|
||||||
await this.alfrescoJsApi.login(program.username, program.password);
|
await this.alfrescoJsApi.login(program.username, program.password);
|
||||||
@ -40,6 +43,60 @@ async function checkEnv() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function checkDiskSpaceFullEnv() {
|
||||||
|
this.alfrescoJsApi = new alfrescoApi.AlfrescoApiCompatibility({
|
||||||
|
provider: 'ECM',
|
||||||
|
hostEcm: program.host
|
||||||
|
});
|
||||||
|
|
||||||
|
await this.alfrescoJsApi.login(program.username, program.password);
|
||||||
|
|
||||||
|
let folder;
|
||||||
|
|
||||||
|
try {
|
||||||
|
folder = await alfrescoJsApi.nodes.addNode('-my-', {
|
||||||
|
'name': `try-env`,
|
||||||
|
'relativePath': `Builds`,
|
||||||
|
'nodeType': 'cm:folder'
|
||||||
|
}, {}, {
|
||||||
|
'overwrite': true
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
folder = await alfrescoJsApi.nodes.getNode('-my-', {
|
||||||
|
'relativePath': `Builds/try-env`,
|
||||||
|
'nodeType': 'cm:folder'
|
||||||
|
}, {}, {
|
||||||
|
'overwrite': true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
let pathFile = path.join(__dirname, '../../', 'README.md');
|
||||||
|
let file = fs.createReadStream(pathFile);
|
||||||
|
|
||||||
|
let uploadedFile = await alfrescoJsApi.upload.uploadFile(
|
||||||
|
file,
|
||||||
|
'',
|
||||||
|
folder.entry.id,
|
||||||
|
null,
|
||||||
|
{
|
||||||
|
'name': 'README.md',
|
||||||
|
'nodeType': 'cm:content',
|
||||||
|
'autoRename': true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
this.alfrescoJsApi.node.deleteNode(uploadedFile.entry.id, {permanent: true});
|
||||||
|
} catch (error) {
|
||||||
|
console.log('=============================================================');
|
||||||
|
console.log('================ Not able to upload a file ==================');
|
||||||
|
console.log('================ Possible cause CS is full ==================');
|
||||||
|
console.log('=============================================================');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function sleep(delay) {
|
function sleep(delay) {
|
||||||
var start = new Date().getTime();
|
var start = new Date().getTime();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user