Fix signature of checkForPortBindingsConflict

This commit is contained in:
Girish Ramakrishnan
2024-07-16 19:31:54 +02:00
parent 6d73dfdb40
commit 620c49cf76
2 changed files with 15 additions and 15 deletions
+8 -8
View File
@@ -29,26 +29,26 @@ describe('Apps', function () {
});
it('throws on exact conflict', async function () {
let [error] = await safe(apps._checkForPortBindingConflict([{ hostPort: 40000, type: 'tcp', portCount: 1 }]));
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 }]));
[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 }]));
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 }]));
[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 }]);
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 }], {});
});
});