backups: split config and policy
keeping them together makes the test/validation quite complicated. for example, when policy is changed, we test the storage backends part of #817
This commit is contained in:
@@ -53,17 +53,23 @@ describe('Settings', function () {
|
||||
expect(newBackupConfig.backupFolder).to.be('/tmp/backups');
|
||||
});
|
||||
|
||||
it('cannot set backup config with invalid schedulePattern', async function () {
|
||||
let backupConfig = await settings.getBackupConfig();
|
||||
backupConfig.schedulePattern = '';
|
||||
const [error] = await safe(settings.setBackupConfig(backupConfig));
|
||||
it('cannot set backup policy with invalid schedule', async function () {
|
||||
const [error] = await safe(settings.setBackupPolicy({ schedule: '', retention: { keepWithinSecs: 1 }}));
|
||||
expect(error.reason).to.be(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
it('can set backup config with valid schedulePattern', async function () {
|
||||
let backupConfig = await settings.getBackupConfig();
|
||||
backupConfig.schedulePattern = '00 00 2,23 * * 0,1,2';
|
||||
await settings.setBackupConfig(backupConfig);
|
||||
it('cannot set backup policy with missing retention', async function () {
|
||||
const [error] = await safe(settings.setBackupPolicy({ schedule: '00 * * * * *'}));
|
||||
expect(error.reason).to.be(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
it('cannot set backup policy with invalid retention', async function () {
|
||||
const [error] = await safe(settings.setBackupPolicy({ schedule: '00 * * * * *', retention: { keepWhenever: 4 }}));
|
||||
expect(error.reason).to.be(BoxError.BAD_FIELD);
|
||||
});
|
||||
|
||||
it('can set valid backup policy', async function () {
|
||||
await settings.setBackupPolicy({ schedule: '00 00 2,23 * * 0,1,2', retention: { keepWithinSecs: 1 }});
|
||||
});
|
||||
|
||||
it('can get default unstable apps setting', async function () {
|
||||
|
||||
Reference in New Issue
Block a user