Fix digitalocean selfhost restore test

This commit is contained in:
Johannes Zellner 2016-10-13 16:41:59 +02:00
parent b3571c583a
commit cfc534539e
1 changed files with 22 additions and 0 deletions

View File

@ -31,6 +31,7 @@ const DO_TYPE = '1gb';
const DO_REGION = 'nyc3';
const DO_TOKEN = process.env.DIGITAL_OCEAN_TOKEN_STAGING;
const BACKUP_KEY = 'somesecret';
const BACKUP_FOLDER = '/tmp/' + process.env.DO_SELFHOST_DOMAIN;
function machine(args, options) {
// https://github.com/nodejs/node-v0.x-archive/issues/9265
@ -195,6 +196,26 @@ describe('Selfhost DigitalOcean Cloudron creation', function () {
assert.strictEqual(backupInfo.dependsOn.length, 1);
});
it('can list backups', function () {
var out = machine('backup list ' + DO_SELFHOST_DOMAIN);
console.log(out.stdout, out.stderr);
var lastBackupId = out.stdout.split('\n').filter(function (l) { return l.indexOf('backup_') === 0; }).map(function (l) { return l.split(' ')[0].trim(); }).pop();
console.log('Last backup id:', lastBackupId);
assert.equal(lastBackupId, backupInfo.id);
});
it('can download backups', function () {
var out = machine('backup download ' + DO_SELFHOST_DOMAIN + ' --backup-id ' + backupInfo.id + ' ' + BACKUP_FOLDER);
console.log(out.stdout, out.stderr);
if (out.stdout.indexOf(backupInfo.id) === -1) assert(false, 'Download failed');
// TODO verify the md5sum
});
it('can restore the box', function () {
var params = [
'--fqdn ' + DO_SELFHOST_DOMAIN,
@ -205,6 +226,7 @@ describe('Selfhost DigitalOcean Cloudron creation', function () {
// '--ssh-key ' + SSH_KEY,
// '--backup-key ' + BACKUP_KEY,
'--backup ' + backupInfo.id,
'--backup-folder ' + BACKUP_FOLDER
];
var out = machine('restore digitalocean ' + params.join(' '));