diff --git a/README.md b/README.md index 5a1c926..e69de29 100644 --- a/README.md +++ b/README.md @@ -1,7 +0,0 @@ -Tests -===== - -* Create v -* Publish new version -* Update to v+1 - diff --git a/test/update-test.js b/test/update-test.js index f2cfc31..3c77025 100644 --- a/test/update-test.js +++ b/test/update-test.js @@ -3,7 +3,8 @@ /* * This tests a flow for the cloudron owner updating a cloudron. * 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'; @@ -11,10 +12,12 @@ var AppStore = require('../appstore.js'), assert = require('assert'), Cloudron = require('../cloudron.js'), + execSync = require('child_process').execSync. path = require('path'), readlineSync = require('readline-sync'), request = require('superagent-sync'), semver = require('semver'), + sleep = require('sleep').sleep, util = require('util'); require('colors'); @@ -45,7 +48,7 @@ describe('Cloudron update testing', function () { email: 'test@cloudron.io' }; - var res, fromVersion, toVersion, cloudron, appId, box; + var res, fromVersion, toVersion, cloudron, appId, box, nextVersion; it('can query versions', function () { 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); fromVersion = boxVersions[1]; toVersion = boxVersions[0]; + nextVersion = semver.inc(toVersion, 'patch'); 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'); }); + 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 () { cloudron.uninstallApp(appId); });