rerelease in before/after scripts
This commit is contained in:
parent
ed62ae7bf3
commit
7935e79b07
@ -8,12 +8,12 @@ export DEBUG_COLORS=true
|
||||
test_pids=()
|
||||
test_logs=()
|
||||
|
||||
# cleanup
|
||||
# before
|
||||
rm -f logs/*
|
||||
echo "Cleaning up"
|
||||
if ! ./node_modules/.bin/mocha --bail test/000-cleanup.js > "logs/000-cleanup.log" 2>&1; then
|
||||
echo "Cleanup script failed"
|
||||
cat "logs/000-cleanup.log"
|
||||
echo "Before"
|
||||
if ! ./node_modules/.bin/mocha --bail test/before.js > "logs/before.log" 2>&1; then
|
||||
echo "Before script failed"
|
||||
cat "logs/before.log"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -50,6 +50,14 @@ done
|
||||
|
||||
kill -9 "${tail_pid}"
|
||||
|
||||
# after
|
||||
echo "After"
|
||||
if ! ./node_modules/.bin/mocha --bail test/after.js > "logs/after.js" 2>&1; then
|
||||
echo "After script failed"
|
||||
cat "logs/after.log"
|
||||
fi
|
||||
|
||||
# dump logs for email
|
||||
echo
|
||||
echo
|
||||
for log_file in "${test_logs[@]}"; do
|
||||
|
22
test/after.js
Normal file
22
test/after.js
Normal file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/*
|
||||
* This test cleans up all t-* cloudrons from previous run.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var AppStore = require('../appstore.js'),
|
||||
common = require('../common.js'),
|
||||
execSync = require('child_process').execSync;
|
||||
|
||||
require('colors');
|
||||
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
||||
|
||||
describe('Revert fake release', function () {
|
||||
it('can revert the fake release from staging', function () {
|
||||
execSync(__dirname + '/../../release/release revert --env staging', { stdio: [ null, process.stdout, process.stderr ] });
|
||||
});
|
||||
});
|
||||
|
@ -7,7 +7,8 @@
|
||||
'use strict';
|
||||
|
||||
var AppStore = require('../appstore.js'),
|
||||
common = require('../common.js');
|
||||
common = require('../common.js'),
|
||||
execSync = require('child_process').execSync;
|
||||
|
||||
require('colors');
|
||||
|
||||
@ -41,3 +42,9 @@ describe('Cleanup old cloudrons', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Fake release', function () {
|
||||
it('can release a fake version to staging', function () {
|
||||
execSync(__dirname + '/../../release/release rerelease --env staging', { stdio: [ null, process.stdout, process.stderr ] });
|
||||
});
|
||||
});
|
||||
|
@ -13,7 +13,6 @@ var AppStore = require('../appstore.js'),
|
||||
assert = require('assert'),
|
||||
Cloudron = require('../cloudron.js'),
|
||||
common = require('../common.js'),
|
||||
execSync = require('child_process').execSync,
|
||||
request = require('superagent-sync'),
|
||||
semver = require('semver'),
|
||||
sleep = require('sleep').sleep;
|
||||
@ -22,6 +21,8 @@ require('colors');
|
||||
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
|
||||
|
||||
var BOX_VERSION = process.env.BOX_VERSION;
|
||||
|
||||
describe('Cloudron update testing', function () {
|
||||
this.timeout(0);
|
||||
|
||||
@ -31,20 +32,13 @@ describe('Cloudron update testing', function () {
|
||||
var admin = common.getAdmin();
|
||||
var res, fromVersion, toVersion, cloudron, appId, box, nextVersion;
|
||||
|
||||
before('can release a fake version to staging', function () {
|
||||
execSync(__dirname + '/../../release/release rerelease --env staging', { stdio: [ null, process.stdout, process.stderr ] });
|
||||
});
|
||||
|
||||
after('can revert the fake release from staging', function () {
|
||||
execSync(__dirname + '/../../release/release revert --env staging', { stdio: [ null, process.stdout, process.stderr ] });
|
||||
});
|
||||
|
||||
it('can query versions', function () {
|
||||
res = request.get('https://s3.amazonaws.com/staging-cloudron-releases/versions.json').end();
|
||||
common.verifyResponse2xx(res);
|
||||
var boxVersions = Object.keys(common.stripUnreachable(res.body)).sort(semver.rcompare);
|
||||
fromVersion = boxVersions[2]; // we released a new version in before()
|
||||
fromVersion = boxVersions[2]; // we released a new version in before.js
|
||||
toVersion = boxVersions[1];
|
||||
assert.strictEqual(toVersion, BOX_VERSION);
|
||||
nextVersion = boxVersions[0];
|
||||
|
||||
console.log('Will test update from %s to %s', fromVersion.yellow, toVersion.yellow);
|
||||
|
Loading…
Reference in New Issue
Block a user