backups: use a real targetId

This commit is contained in:
Girish Ramakrishnan
2025-07-25 07:44:25 +02:00
parent cfce39c1de
commit 276db17f0c
12 changed files with 81 additions and 62 deletions
+20 -9
View File
@@ -17,7 +17,7 @@ const archives = require('../archives.js'),
timers = require('timers/promises');
describe('backup cleaner', function () {
const { setup, cleanup, app } = common;
const { setup, cleanup, app, getDefaultBackupTarget } = common;
before(setup);
after(cleanup);
@@ -139,7 +139,8 @@ describe('backup cleaner', function () {
dependsOn: [ 'backup-app-00', 'backup-app-01' ],
manifest: null,
preserveSecs: 0,
appConfig: null
appConfig: null,
targetId: null
};
const BACKUP_0_APP_0 = { // backup of installed app
@@ -153,7 +154,8 @@ describe('backup cleaner', function () {
dependsOn: [],
manifest: null,
preserveSecs: 0,
appConfig: null
appConfig: null,
targetId: null
};
const BACKUP_0_APP_1 = { // this app is uninstalled
@@ -167,7 +169,8 @@ describe('backup cleaner', function () {
dependsOn: [],
manifest: null,
preserveSecs: 0,
appConfig: null
appConfig: null,
targetId: null
};
const BACKUP_1_BOX = {
@@ -181,7 +184,8 @@ describe('backup cleaner', function () {
dependsOn: [ 'backup-app-10', 'backup-app-11' ],
manifest: null,
preserveSecs: 0,
appConfig: null
appConfig: null,
targetId: null
};
const BACKUP_1_APP_0 = {
@@ -195,7 +199,8 @@ describe('backup cleaner', function () {
dependsOn: [],
manifest: null,
preserveSecs: 0,
appConfig: null
appConfig: null,
targetId: null
};
const BACKUP_1_APP_1 = {
@@ -209,7 +214,8 @@ describe('backup cleaner', function () {
dependsOn: [],
manifest: null,
preserveSecs: 0,
appConfig: null
appConfig: null,
targetId: null
};
const BACKUP_2_APP_2 = { // this is archived and left alone
@@ -223,11 +229,12 @@ describe('backup cleaner', function () {
dependsOn: [],
manifest: null,
preserveSecs: 0,
appConfig: null
appConfig: null,
targetId: null
};
before(async function () {
target = await backupTargets._getDefault();
target = await getDefaultBackupTarget();
await backupTargets.setConfig(target, {
provider: 'filesystem',
backupFolder: '/tmp/someplace',
@@ -258,6 +265,10 @@ describe('backup cleaner', function () {
});
it('add the backups', async function () {
for (const b of [BACKUP_0_APP_0, BACKUP_0_APP_1, BACKUP_0_BOX, BACKUP_1_APP_0, BACKUP_1_APP_1, BACKUP_1_BOX, BACKUP_2_APP_2]) {
b.targetId = target.id;
}
BACKUP_0_APP_0.id = await backups.add(BACKUP_0_APP_0);
BACKUP_0_APP_1.id = await backups.add(BACKUP_0_APP_1);
BACKUP_0_BOX.dependsOn = [ BACKUP_0_APP_0.id, BACKUP_0_APP_1.id ];