Add backup config test for each backend
This commit is contained in:
+13
-1
@@ -9,13 +9,16 @@ exports = module.exports = {
|
||||
getLocalFilePath: getLocalFilePath,
|
||||
|
||||
copyObject: copyObject,
|
||||
removeBackup: removeBackup
|
||||
removeBackup: removeBackup,
|
||||
|
||||
testConfig: testConfig
|
||||
};
|
||||
|
||||
var assert = require('assert'),
|
||||
AWS = require('aws-sdk'),
|
||||
config = require('../config.js'),
|
||||
safe = require('safetydance'),
|
||||
SettingsError = require('../settings.js').SettingsError,
|
||||
superagent = require('superagent');
|
||||
|
||||
function getBackupCredentials(apiConfig, callback) {
|
||||
@@ -171,3 +174,12 @@ function removeBackup(apiConfig, backupId, appBackupIds, callback) {
|
||||
|
||||
callback(new Error('not implemented'));
|
||||
}
|
||||
|
||||
function testConfig(apiConfig, callback) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
if (config.provider() !== 'caas') return callback(new SettingsError(SettingsError.BAD_FIELD, 'instance provider must be caas'));
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@ exports = module.exports = {
|
||||
getLocalFilePath: getLocalFilePath,
|
||||
|
||||
copyObject: copyObject,
|
||||
removeBackup: removeBackup
|
||||
removeBackup: removeBackup,
|
||||
|
||||
testConfig: testConfig
|
||||
};
|
||||
|
||||
var assert = require('assert'),
|
||||
@@ -19,6 +21,7 @@ var assert = require('assert'),
|
||||
fs = require('fs'),
|
||||
path = require('path'),
|
||||
safe = require('safetydance'),
|
||||
SettingsError = require('../settings.js').SettingsError,
|
||||
shell = require('../shell.js'),
|
||||
util = require('util');
|
||||
|
||||
@@ -139,3 +142,12 @@ function removeBackup(apiConfig, backupId, appBackupIds, callback) {
|
||||
});
|
||||
}, callback);
|
||||
}
|
||||
|
||||
function testConfig(apiConfig, callback) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
if (typeof apiConfig.backupFolder !== 'string') return callback(new SettingsError(SettingsError.BAD_FIELD, 'backupFolder must be string'));
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
@@ -15,7 +15,9 @@ exports = module.exports = {
|
||||
getLocalFilePath: getLocalFilePath,
|
||||
|
||||
copyObject: copyObject,
|
||||
removeBackup: removeBackup
|
||||
removeBackup: removeBackup,
|
||||
|
||||
testConfig: testConfig
|
||||
};
|
||||
|
||||
var assert = require('assert');
|
||||
@@ -100,3 +102,12 @@ function removeBackup(apiConfig, backupId, appBackupIds, callback) {
|
||||
|
||||
callback(new Error('not implemented'));
|
||||
}
|
||||
|
||||
function testConfig(apiConfig, callback) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
// Result: none
|
||||
|
||||
callback(new Error('not implemented'));
|
||||
}
|
||||
|
||||
+16
-1
@@ -9,12 +9,15 @@ exports = module.exports = {
|
||||
getLocalFilePath: getLocalFilePath,
|
||||
|
||||
copyObject: copyObject,
|
||||
removeBackup: removeBackup
|
||||
removeBackup: removeBackup,
|
||||
|
||||
testConfig: testConfig
|
||||
};
|
||||
|
||||
var assert = require('assert'),
|
||||
AWS = require('aws-sdk'),
|
||||
safe = require('safetydance'),
|
||||
SettingsError = require('../settings.js').SettingsError,
|
||||
superagent = require('superagent');
|
||||
|
||||
function getBackupCredentials(apiConfig, callback) {
|
||||
@@ -150,3 +153,15 @@ function removeBackup(apiConfig, backupId, appBackupIds, callback) {
|
||||
|
||||
callback(new Error('not implemented'));
|
||||
}
|
||||
|
||||
function testConfig(apiConfig, callback) {
|
||||
assert.strictEqual(typeof apiConfig, 'object');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
if (typeof apiConfig.accessKeyId !== 'string') return callback(new SettingsError(SettingsError.BAD_FIELD, 'accessKeyId must be a string'));
|
||||
if (typeof apiConfig.secretAccessKey !== 'string') return callback(new SettingsError(SettingsError.BAD_FIELD, 'secretAccessKey must be a string'));
|
||||
if (typeof apiConfig.bucket !== 'string') return callback(new SettingsError(SettingsError.BAD_FIELD, 'bucket must be a string'));
|
||||
if (typeof apiConfig.prefix !== 'string') return callback(new SettingsError(SettingsError.BAD_FIELD, 'prefix must be a string'));
|
||||
|
||||
callback();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user