Test update to v+1
This commit is contained in:
parent
39d560fcf7
commit
a4297b722e
@ -3,7 +3,8 @@
|
|||||||
/*
|
/*
|
||||||
* This tests a flow for the cloudron owner updating a cloudron.
|
* This tests a flow for the cloudron owner updating a cloudron.
|
||||||
* It checks if an existing installed app retains it's data after
|
* It checks if an existing installed app retains it's data after
|
||||||
* an update.
|
* an update. It then check if the cloudron can be updated to
|
||||||
|
* the next (unreleased) version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
@ -11,10 +12,12 @@
|
|||||||
var AppStore = require('../appstore.js'),
|
var AppStore = require('../appstore.js'),
|
||||||
assert = require('assert'),
|
assert = require('assert'),
|
||||||
Cloudron = require('../cloudron.js'),
|
Cloudron = require('../cloudron.js'),
|
||||||
|
execSync = require('child_process').execSync.
|
||||||
path = require('path'),
|
path = require('path'),
|
||||||
readlineSync = require('readline-sync'),
|
readlineSync = require('readline-sync'),
|
||||||
request = require('superagent-sync'),
|
request = require('superagent-sync'),
|
||||||
semver = require('semver'),
|
semver = require('semver'),
|
||||||
|
sleep = require('sleep').sleep,
|
||||||
util = require('util');
|
util = require('util');
|
||||||
|
|
||||||
require('colors');
|
require('colors');
|
||||||
@ -45,7 +48,7 @@ describe('Cloudron update testing', function () {
|
|||||||
email: 'test@cloudron.io'
|
email: 'test@cloudron.io'
|
||||||
};
|
};
|
||||||
|
|
||||||
var res, fromVersion, toVersion, cloudron, appId, box;
|
var res, fromVersion, toVersion, cloudron, appId, box, nextVersion;
|
||||||
|
|
||||||
it('can query versions', function () {
|
it('can query versions', function () {
|
||||||
res = request.get('https://s3.amazonaws.com/staging-cloudron-releases/versions.json').end();
|
res = request.get('https://s3.amazonaws.com/staging-cloudron-releases/versions.json').end();
|
||||||
@ -53,6 +56,7 @@ describe('Cloudron update testing', function () {
|
|||||||
var boxVersions = Object.keys(res.body).sort(semver.rcompare);
|
var boxVersions = Object.keys(res.body).sort(semver.rcompare);
|
||||||
fromVersion = boxVersions[1];
|
fromVersion = boxVersions[1];
|
||||||
toVersion = boxVersions[0];
|
toVersion = boxVersions[0];
|
||||||
|
nextVersion = semver.inc(toVersion, 'patch');
|
||||||
|
|
||||||
console.log('Will test update from %s to %s', fromVersion.yellow, toVersion.yellow);
|
console.log('Will test update from %s to %s', fromVersion.yellow, toVersion.yellow);
|
||||||
});
|
});
|
||||||
@ -121,6 +125,32 @@ describe('Cloudron update testing', function () {
|
|||||||
assert.strictEqual(res.body.mongodb, 'OK');
|
assert.strictEqual(res.body.mongodb, 'OK');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('can release a fake version to staging', function () {
|
||||||
|
execSync(__dirname + '../../installer/release/release rerelease --env staging', { stdio: [ null, process.stdout, process.stderr ] });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('can update to new version', function () {
|
||||||
|
console.log('Wait for cloudron to get the update');
|
||||||
|
sleep(60 * 2);
|
||||||
|
cloudron.update(nextVersion);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('runs the app', function () {
|
||||||
|
cloudron.waitForApp(appId);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('can check the addons', function () {
|
||||||
|
var res = request.post('https://' + location + '-' + box.domain + '/check_addons').end();
|
||||||
|
assert.strictEqual(res.statusCode, 200);
|
||||||
|
assert.strictEqual(res.body.mysql, 'OK');
|
||||||
|
assert.strictEqual(res.body.postgresql, 'OK');
|
||||||
|
assert.strictEqual(res.body.mongodb, 'OK');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('can revert the fake release from staging', function () {
|
||||||
|
execSync(__dirname + '../../installer/release/release revert --env staging', { stdio: [ null, process.stdout, process.stderr ] });
|
||||||
|
});
|
||||||
|
|
||||||
it('can uninstall app', function () {
|
it('can uninstall app', function () {
|
||||||
cloudron.uninstallApp(appId);
|
cloudron.uninstallApp(appId);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user