Remove usage of config.appFqdn()

This commit is contained in:
Girish Ramakrishnan
2018-01-09 21:03:59 -08:00
parent c108cd2d5f
commit efc0a3b68d
15 changed files with 176 additions and 138 deletions

View File

@@ -161,35 +161,35 @@ describe('Apps', function () {
describe('validateHostname', function () {
it('does not allow admin subdomain', function () {
expect(apps._validateHostname('my', 'example.com')).to.be.an(Error);
expect(apps._validateHostname('my', 'example.com', 'my.example.com')).to.be.an(Error);
});
it('cannot have >63 length subdomains', function () {
var s = '';
for (var i = 0; i < 64; i++) s += 's';
expect(apps._validateHostname(s, 'example.com')).to.be.an(Error);
expect(apps._validateHostname(s, 'example.com', s + '.example.com')).to.be.an(Error);
});
it('allows only alphanumerics and hypen', function () {
expect(apps._validateHostname('#2r', 'example.com')).to.be.an(Error);
expect(apps._validateHostname('a%b', 'example.com')).to.be.an(Error);
expect(apps._validateHostname('ab_', 'example.com')).to.be.an(Error);
expect(apps._validateHostname('a.b', 'example.com')).to.be.an(Error);
expect(apps._validateHostname('-ab', 'example.com')).to.be.an(Error);
expect(apps._validateHostname('ab-', 'example.com')).to.be.an(Error);
expect(apps._validateHostname('#2r', 'example.com', '#2r.example.com')).to.be.an(Error);
expect(apps._validateHostname('a%b', 'example.com', 'a%b.example.com')).to.be.an(Error);
expect(apps._validateHostname('ab_', 'example.com', 'ab_.example.com')).to.be.an(Error);
expect(apps._validateHostname('a.b', 'example.com', 'a.b.example.com')).to.be.an(Error);
expect(apps._validateHostname('-ab', 'example.com', '-ab.example.com')).to.be.an(Error);
expect(apps._validateHostname('ab-', 'example.com', 'ab-.example.com')).to.be.an(Error);
});
it('total length cannot exceed 255', function () {
var s = '';
for (var i = 0; i < (255 - 'example.com'.length); i++) s += 's';
expect(apps._validateHostname(s, 'example.com')).to.be.an(Error);
expect(apps._validateHostname(s, 'example.com', s + '.example.com')).to.be.an(Error);
});
it('allow valid domains', function () {
expect(apps._validateHostname('a', 'example.com')).to.be(null);
expect(apps._validateHostname('a0-x', 'example.com')).to.be(null);
expect(apps._validateHostname('01', 'example.com')).to.be(null);
expect(apps._validateHostname('a', 'example.com', 'a.example.com')).to.be(null);
expect(apps._validateHostname('a0-x', 'example.com', 'a0-x.example.com')).to.be(null);
expect(apps._validateHostname('01', 'example.com', '01.example.com')).to.be(null);
});
});

View File

@@ -67,6 +67,8 @@ var APP = {
runState: null,
location: 'applocation',
domain: DOMAIN_0.domain,
intrinsicFqdn: DOMAIN_0.domain + '.' + 'applocation',
fqdn: DOMAIN_0.domain + '.' + 'applocation',
manifest: MANIFEST,
containerId: null,
httpPort: 4567,
@@ -101,6 +103,7 @@ describe('apptask', function () {
async.series([
database.initialize,
database._clear,
domains.update.bind(null, DOMAIN_0.domain, DOMAIN_0.provider, DOMAIN_0.config, null),
appdb.add.bind(null, APP.id, APP.appStoreId, APP.manifest, APP.location, APP.domain, APP.portBindings, APP),
settings.initialize,

View File

@@ -68,7 +68,6 @@ describe('config', function () {
expect(config.isCustomDomain()).to.equal(true);
expect(config.fqdn()).to.equal('example.com');
expect(config.adminOrigin()).to.equal('https://my.example.com');
expect(config.appFqdn({ location: 'app', domain: config.fqdn() })).to.equal('app.example.com');
expect(config.zoneName()).to.equal('example.com');
});
@@ -79,7 +78,6 @@ describe('config', function () {
expect(config.isCustomDomain()).to.equal(false);
expect(config.fqdn()).to.equal('test.example.com');
expect(config.adminOrigin()).to.equal('https://my-test.example.com');
expect(config.appFqdn({ location: 'app', domain: config.fqdn() })).to.equal('app-test.example.com');
expect(config.zoneName()).to.equal('example.com');
});