Fix tests

This commit is contained in:
Girish Ramakrishnan
2023-07-11 16:32:28 +05:30
parent 2d4e7c9c0a
commit 5beb7d7d92
5 changed files with 15 additions and 16 deletions
+7 -7
View File
@@ -39,10 +39,6 @@ describe('backuptask', function () {
await settings.setBackupConfig(backupConfig);
});
after(function () {
fs.rmSync(backupConfig.backupFolder, { recursive: true, force: true });
});
async function createBackup() {
const taskId = await backups.startBackupTask({ username: 'test' });
@@ -76,7 +72,7 @@ describe('backuptask', function () {
const result = await createBackup();
expect(fs.statSync(path.join(backupConfig.backupFolder, 'snapshot/box.tar.gz')).nlink).to.be(2); // hard linked to a rotated backup
expect(fs.statSync(path.join(backupConfig.backupFolder, `${result.id}.tar.gz`)).nlink).to.be(2);
expect(fs.statSync(path.join(backupConfig.backupFolder, `${result.remotePath}.tar.gz`)).nlink).to.be(2);
backupInfo1 = result;
});
@@ -90,8 +86,12 @@ describe('backuptask', function () {
const result = await createBackup();
expect(fs.statSync(path.join(backupConfig.backupFolder, 'snapshot/box.tar.gz')).nlink).to.be(2); // hard linked to a rotated backup
expect(fs.statSync(path.join(backupConfig.backupFolder, `${result.id}.tar.gz`)).nlink).to.be(2); // hard linked to new backup
expect(fs.statSync(path.join(backupConfig.backupFolder, `${backupInfo1.id}.tar.gz`)).nlink).to.be(1); // not hard linked anymore
expect(fs.statSync(path.join(backupConfig.backupFolder, `${result.remotePath}.tar.gz`)).nlink).to.be(2); // hard linked to new backup
expect(fs.statSync(path.join(backupConfig.backupFolder, `${backupInfo1.remotePath}.tar.gz`)).nlink).to.be(1); // not hard linked anymore
});
it('cleanup', function () {
fs.rmSync(backupConfig.backupFolder, { recursive: true, force: true });
});
});
});