Add test for alt domain as naked domain

This commit is contained in:
Girish Ramakrishnan 2017-04-26 16:13:41 -07:00
parent 87c7c3cdb9
commit 58f6750fa4
1 changed files with 91 additions and 0 deletions

View File

@ -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);
});