diff --git a/test/alt-domain-test.js b/test/alt-domain-test.js index f6f610f..f5a34e2 100644 --- a/test/alt-domain-test.js +++ b/test/alt-domain-test.js @@ -58,6 +58,7 @@ describe('Alt domain test', function () { cloudron.setEmailEnabled(true); }); + ////////////////////////////////////////////////////// Test sub domain as alt domain var location = 'test' + (Math.random() * 10000).toFixed(); it('can install app', function () { var manifest = appStore.getManifest(common.TESTAPP_ID, common.TESTAPP_VERSION); @@ -146,6 +147,96 @@ describe('Alt domain test', function () { }); }); + ////////////////////////////////////////////////////// Test naked domain as alt domain + location = 'test' + (Math.random() * 10000).toFixed(); + it('can install app', function () { + var manifest = appStore.getManifest(common.TESTAPP_ID, common.TESTAPP_VERSION); + appId = cloudron.installApp(location, manifest); + }); + + it('can populate the addons', function () { + cloudron.populateAddons(cloudron.appFqdn(location)); + }); + + it('can check the addons', function () { + cloudron.checkAddons(cloudron.appFqdn(location), owner); + }); + + it('can setup A for altlocation', function (done) { + route53.listHostedZonesByName({ DNSName: CUSTOM_DOMAIN, MaxItems: '1'}, function (error, result) { + if (error) return done(error); + + var params = { + ChangeBatch: { + Changes: [{ + Action: 'UPSERT', + ResourceRecordSet: { + Type: 'A', + Name: CUSTOM_DOMAIN + '.', + ResourceRecords: [ { Value: box.ip } ], + TTL: 1 + } + }] + }, + HostedZoneId: result.HostedZones[0].Id + }; + + route53.changeResourceRecordSets(params, function(error) { + if (error) return done(error); + + done(); + }); + }); + }); + + it('can configure app to alt location', function () { + cloudron.configureApp(appId, location, CUSTOM_DOMAIN); + }); + + it('can check the addons', function () { + cloudron.checkAddons(CUSTOM_DOMAIN, owner); + }); + + it('can reboot the cloudron', function () { + cloudron.reboot(); + }); + + it('can check the addons', function () { + cloudron.checkAddons(CUSTOM_DOMAIN, owner); + }); + + it('can uninstall app', function () { + cloudron.uninstallApp(appId); + }); + + it('can delete cname for altlocation', function (done) { + route53.listHostedZonesByName({ DNSName: CUSTOM_DOMAIN, MaxItems: '1'}, function (error, result) { + if (error) return done(error); + + var params = { + ChangeBatch: { + Changes: [{ + Action: 'DELETE', + ResourceRecordSet: { + Type: 'A', + Name: CUSTOM_DOMAIN + '.', + ResourceRecords: [ { Value: box.ip } ], + TTL: 1 + } + }] + }, + HostedZoneId: result.HostedZones[0].Id + }; + + route53.changeResourceRecordSets(params, function(error) { + if (error) return done(error); + + done(); + }); + }); + }); + + it('can delete the cloudron', function () { appStore.deleteCloudron(box); });