make custom domain test more complete

This commit is contained in:
Girish Ramakrishnan 2015-12-17 20:41:54 -08:00
parent a05941e155
commit 3d49216486
1 changed files with 43 additions and 6 deletions

View File

@ -9,11 +9,13 @@
'use strict';
var AppStore = require('../appstore.js'),
assert = require('assert'),
async = require('async'),
AWS = require('aws-sdk'),
Cloudron = require('../cloudron.js'),
common = require('../common.js'),
dns = require('dns');
dns = require('dns'),
request = require('superagent-sync');
require('colors');
@ -29,7 +31,7 @@ describe('Appstore new user flow', function () {
var owner = common.getOwner();
var admin = common.getAdmin();
var cloudron, appId, box;
var cloudron, appId, box, backupInfo;
it('can login to the store', function () {
var accessToken = appStore.getAccessToken(owner);
@ -104,18 +106,53 @@ describe('Appstore new user flow', function () {
it('can set dns credentials', function () {
cloudron.setDnsConfig({ provider: 'route53', accessKeyId: process.env.AWS_STAGING_ACCESS_KEY, secretAccessKey: process.env.AWS_STAGING_SECRET_KEY });
});
var location = 'haste' + (Math.random() * 10000).toFixed();
var location = 'test' + (Math.random() * 10000).toFixed();
it('can install app', function () {
var manifest = appStore.getManifest('com.hastebin.cloudronapp', '0.1.1');
var manifest = appStore.getManifest(common.TESTAPP_ID, common.TESTAPP_VERSION);
appId = cloudron.installApp(location, manifest);
});
it('can populate the addons', function () {
var res = request.post('https://' + location + '-' + box.domain + '/populate_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');
assert.strictEqual(res.body.localstorage, 'OK');
assert.strictEqual(res.body.redis, 'OK');
});
it('can check the addons', function () {
cloudron.checkAddons(location, owner);
});
it('can backup the box', function () {
backupInfo = cloudron.backup();
assert.strictEqual(backupInfo.dependsOn.length, 1);
});
it('can restore the box', function () {
appStore.restore(box.id, backupInfo.restoreKey);
box = appStore.waitForCloudron(box.id);
});
it('can configure app', function () {
location = location + 'x';
cloudron.configureApp(appId, location);
});
it('can check the addons', function () {
cloudron.checkAddons(location, owner);
});
it('can reboot the cloudron', function () {
cloudron.reboot();
});
it('can check the addons', function () {
cloudron.checkAddons(location, owner);
});
it('can uninstall app', function () {
cloudron.uninstallApp(appId);
});
@ -123,7 +160,7 @@ describe('Appstore new user flow', function () {
// check this after activation
it('has setup DNS records correctly', function (done) {
async.series([
cloudron.checkA.bind(cloudron),
// cloudron.checkA.bind(cloudron), // this is at user's discretion
cloudron.checkSPF.bind(cloudron),
cloudron.checkDKIM.bind(cloudron),
cloudron.checkDMARC.bind(cloudron)