rename location to subdomain

the primary subdomain was previously called 'location'. but the alias/secondary/redirect
subdomain is called 'subdomain'. this makes it all consistent.

location terminology is now used for { subdomain, domain } pair
This commit is contained in:
Girish Ramakrishnan
2022-01-16 12:32:12 -08:00
parent 1e2f01cc69
commit e8d08968a1
11 changed files with 122 additions and 122 deletions

View File

@@ -173,16 +173,16 @@ describe('Apps', function () {
});
it('can add app', async function () {
await apps.add(app.id, app.appStoreId, app.manifest, app.location, app.domain, app.portBindings, app);
await apps.add(app.id, app.appStoreId, app.manifest, app.subdomain, app.domain, app.portBindings, app);
});
it('cannot add with same app id', async function () {
const [error] = await safe(apps.add(app.id, app.appStoreId, app.manifest, app.location, app.domain, app.portBindings, app));
const [error] = await safe(apps.add(app.id, app.appStoreId, app.manifest, app.subdomain, app.domain, app.portBindings, app));
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
});
it('cannot add with same app id', async function () {
const [error] = await safe(apps.add(app.id, app.appStoreId, app.manifest, app.location, app.domain, app.portBindings, app));
const [error] = await safe(apps.add(app.id, app.appStoreId, app.manifest, app.subdomain, app.domain, app.portBindings, app));
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
});
@@ -190,7 +190,7 @@ describe('Apps', function () {
const result = await apps.get(app.id);
expect(result.manifest).to.eql(app.manifest);
expect(result.portBindings).to.eql({});
expect(result.location).to.eql(app.location);
expect(result.subdomain).to.eql(app.subdomain);
});
it('can list apps', async function () {
@@ -198,7 +198,7 @@ describe('Apps', function () {
expect(result.length).to.be(1);
expect(result[0].manifest).to.eql(app.manifest);
expect(result[0].portBindings).to.eql({});
expect(result[0].location).to.eql(app.location);
expect(result[0].subdomain).to.eql(app.subdomain);
});
it('can listByUser', async function () {
@@ -212,8 +212,8 @@ describe('Apps', function () {
it('update succeeds', async function () {
const data = {
installationState: 'some-other-status',
location:'some-other-location',
domain: app.domain, // needs to be set whenever location is set
subdomain:'some-other-subdomain',
domain: app.domain, // needs to be set whenever subdomain is set
manifest: Object.assign({}, app.manifest, { version: '0.2.0' }),
accessRestriction: '',
memoryLimit: 1337,
@@ -224,7 +224,7 @@ describe('Apps', function () {
await apps.update(app.id, data);
const newApp = await apps.get(app.id);
expect(newApp.installationState).to.be('some-other-status');
expect(newApp.location).to.be('some-other-location');
expect(newApp.subdomain).to.be('some-other-subdomain');
expect(newApp.manifest.version).to.be('0.2.0');
expect(newApp.accessRestriction).to.be('');
expect(newApp.memoryLimit).to.be(1337);
@@ -232,7 +232,7 @@ describe('Apps', function () {
});
it('update of nonexisting app fails', async function () {
const [error] = await safe(apps.update('random', { installationState: app.installationState, location: app.location }));
const [error] = await safe(apps.update('random', { installationState: app.installationState, subdomain: app.subdomain }));
expect(error.reason).to.be(BoxError.NOT_FOUND);
});
@@ -248,7 +248,7 @@ describe('Apps', function () {
describe('setHealth', function () {
before(async function () {
await apps.add(app.id, app.appStoreId, app.manifest, app.location, app.domain, app.portBindings, app);
await apps.add(app.id, app.appStoreId, app.manifest, app.subdomain, app.domain, app.portBindings, app);
});
it('can set app as healthy', async function () {
@@ -270,13 +270,13 @@ describe('Apps', function () {
});
describe('configureInstalledApps', function () {
const app1 = Object.assign({}, app, { id: 'id1', installationState: apps.ISTATE_ERROR, location: 'loc1' });
const app2 = Object.assign({}, app, { id: 'id2', installationState: apps.ISTATE_INSTALLED, location: 'loc2' });
const app1 = Object.assign({}, app, { id: 'id1', installationState: apps.ISTATE_ERROR, subdomain: 'loc1' });
const app2 = Object.assign({}, app, { id: 'id2', installationState: apps.ISTATE_INSTALLED, subdomain: 'loc2' });
before(async function () {
await apps.update(app.id, { installationState: apps.ISTATE_INSTALLED });
await apps.add(app1.id, app1.appStoreId, app1.manifest, app1.location, app1.domain, app1.portBindings, app1);
await apps.add(app2.id, app2.appStoreId, app2.manifest, app2.location, app2.domain, app2.portBindings, app2);
await apps.add(app1.id, app1.appStoreId, app1.manifest, app1.subdomain, app1.domain, app1.portBindings, app1);
await apps.add(app2.id, app2.appStoreId, app2.manifest, app2.subdomain, app2.domain, app2.portBindings, app2);
});
after(async function () {
@@ -295,13 +295,13 @@ describe('Apps', function () {
});
describe('restoreInstalledApps', function () {
const app1 = Object.assign({}, app, { id: 'id1', installationState: apps.ISTATE_ERROR, location: 'loc1' });
const app2 = Object.assign({}, app, { id: 'id2', installationState: apps.ISTATE_INSTALLED, location: 'loc2' });
const app1 = Object.assign({}, app, { id: 'id1', installationState: apps.ISTATE_ERROR, subdomain: 'loc1' });
const app2 = Object.assign({}, app, { id: 'id2', installationState: apps.ISTATE_INSTALLED, subdomain: 'loc2' });
before(async function () {
await apps.update(app.id, { installationState: apps.ISTATE_INSTALLED });
await apps.add(app1.id, app1.appStoreId, app1.manifest, app1.location, app1.domain, app1.portBindings, app1);
await apps.add(app2.id, app2.appStoreId, app2.manifest, app2.location, app2.domain, app2.portBindings, app2);
await apps.add(app1.id, app1.appStoreId, app1.manifest, app1.subdomain, app1.domain, app1.portBindings, app1);
await apps.add(app2.id, app2.appStoreId, app2.manifest, app2.subdomain, app2.domain, app2.portBindings, app2);
});
after(async function () {