backups: set label of backup and control it's retention
This commit is contained in:
@@ -11,6 +11,7 @@ const constants = require('../../constants.js'),
|
||||
settings = require('../../settings.js'),
|
||||
support = require('../../support.js'),
|
||||
superagent = require('superagent'),
|
||||
tasks = require('../../tasks.js'),
|
||||
tokens = require('../../tokens.js');
|
||||
|
||||
exports = module.exports = {
|
||||
@@ -19,6 +20,7 @@ exports = module.exports = {
|
||||
cleanup,
|
||||
clearMailQueue,
|
||||
checkMails,
|
||||
waitForTask,
|
||||
|
||||
owner: {
|
||||
id: null,
|
||||
@@ -99,3 +101,15 @@ async function checkMails(number) {
|
||||
expect(mailer._mailQueue.length).to.equal(number);
|
||||
clearMailQueue();
|
||||
}
|
||||
|
||||
async function waitForTask(taskId) {
|
||||
// eslint-disable-next-line no-constant-condition
|
||||
for (let i = 0; i < 10; i++) {
|
||||
const result = await tasks.get(taskId);
|
||||
expect(result).to.not.be(null);
|
||||
if (!result.active) return;
|
||||
await delay(2000);
|
||||
console.log(`Waiting for task to ${taskId} finish`);
|
||||
}
|
||||
throw new Error(`Task ${taskId} never finished`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user