From 3d49216486d1e7aa88eb1edc8a8ced4e262d01a4 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Thu, 17 Dec 2015 20:41:54 -0800 Subject: [PATCH] make custom domain test more complete --- test/custom-domain-test.js | 49 +++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/test/custom-domain-test.js b/test/custom-domain-test.js index ac7744e..1da9534 100644 --- a/test/custom-domain-test.js +++ b/test/custom-domain-test.js @@ -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)