Skip to content

Commit 7189fcb

Browse files
committed
fix: resolve pr review comments
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
1 parent cca6421 commit 7189fcb

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

services/libs/test-kit/src/postgres.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export async function openTestWorkerDatabase(): Promise<{
5353

5454
/**
5555
* Truncates all public tables in the worker database.
56-
* @throws {Error} If executed against a non-test database database name.
56+
* @throws {Error} If executed against a non-test database name.
5757
*/
5858
export async function resetTestDatabase(qx: QueryExecutor): Promise<void> {
5959
const { name } = await qx.selectOne('SELECT current_database() AS name')
@@ -147,6 +147,10 @@ function getTestPostgres(): TestPostgres {
147147

148148
const port = Number(DB_PORT)
149149

150+
if (!Number.isInteger(port) || port <= 0 || port > 65535) {
151+
throw new Error(`Expected valid DB_PORT (got ${DB_PORT})`)
152+
}
153+
150154
if (!['localhost', '127.0.0.1', '::1'].includes(host)) {
151155
throw new Error(`Expected local DB_HOST (got ${host})`)
152156
}

0 commit comments

Comments
 (0)