Check for portBindings with range outside the db constraint for now
This commit is contained in:
@@ -19,6 +19,39 @@ describe('Apps', function () {
|
||||
before(domainSetup);
|
||||
after(cleanup);
|
||||
|
||||
describe('checkForPortBindingConflict', function () {
|
||||
before(async function () {
|
||||
await apps.add(app.id, app.appStoreId, app.manifest, app.subdomain, app.domain, [{ hostPort: 40000, type: 'tcp', portCount: 100 }, { hostPort: 50000, type: 'udp', portCount: 1 }], app);
|
||||
});
|
||||
|
||||
after(async function () {
|
||||
await apps.del(app.id);
|
||||
});
|
||||
|
||||
it('throws on exact conflict', async function () {
|
||||
let [error] = await safe(apps._checkForPortBindingConflict([{ hostPort: 40000, type: 'tcp', portCount: 1 }]));
|
||||
expect(error.reason).to.equal(BoxError.CONFLICT);
|
||||
|
||||
[error] = await safe(apps._checkForPortBindingConflict([{ hostPort: 50000, type: 'udp', portCount: 1 }]));
|
||||
expect(error.reason).to.equal(BoxError.CONFLICT);
|
||||
});
|
||||
|
||||
it('throws on range conflict', async function () {
|
||||
let [error] = await safe(apps._checkForPortBindingConflict([{ hostPort: 40080, type: 'tcp', portCount: 40 }]));
|
||||
expect(error.reason).to.equal(BoxError.CONFLICT);
|
||||
|
||||
[error] = await safe(apps._checkForPortBindingConflict([{ hostPort: 49995, type: 'udp', portCount: 20 }]));
|
||||
expect(error.reason).to.equal(BoxError.CONFLICT);
|
||||
});
|
||||
|
||||
it('succeeds without conflict', async function () {
|
||||
await apps._checkForPortBindingConflict([{ hostPort: 39995, type: 'tcp', portCount: 2 }]);
|
||||
await apps._checkForPortBindingConflict([{ hostPort: 45000, type: 'tcp', portCount: 1 }]);
|
||||
await apps._checkForPortBindingConflict([{ hostPort: 49995, type: 'udp', portCount: 2 }]);
|
||||
await apps._checkForPortBindingConflict([{ hostPort: 50001, type: 'udp', portCount: 1 }]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('validateLocations', function () {
|
||||
it('does not allow reserved subdomain', async function () {
|
||||
let location = new Location('my', domain.domain, Location.TYPE_ALIAS);
|
||||
|
||||
Reference in New Issue
Block a user