From a87aa2fafe05c358455173ea65877be5eefcbd63 Mon Sep 17 00:00:00 2001 From: Ciro Spaciari Date: Sat, 14 Oct 2023 20:16:49 -0300 Subject: fix(net/tls) fix pg hang on end + hanging on query (#6487) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix pg hang on end + hanging on query * remove dummy function * fix node-stream * add test * fix test * return error in test * fix test use once instead of on * fix OOM * generated * 💅 * 💅 --- test/js/third_party/postgres/postgres.test.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'test/js/third_party/postgres/postgres.test.ts') diff --git a/test/js/third_party/postgres/postgres.test.ts b/test/js/third_party/postgres/postgres.test.ts index 758fee778..991c85d88 100644 --- a/test/js/third_party/postgres/postgres.test.ts +++ b/test/js/third_party/postgres/postgres.test.ts @@ -1,5 +1,5 @@ import { test, expect, describe } from "bun:test"; -import { Pool } from "pg"; +import { Pool, Client } from "pg"; import { parse } from "pg-connection-string"; import postgres from "postgres"; @@ -19,6 +19,18 @@ describe("pg", () => { pool.end(); } }); + + it("should execute big query and end connection", async () => { + const client = new Client({ + connectionString: CONNECTION_STRING, + ssl: { rejectUnauthorized: false }, + }); + + await client.connect(); + const res = await client.query(`SELECT * FROM users LIMIT 1000`); + expect(res.rows.length).toBeGreaterThanOrEqual(300); + await client.end(); + }, 5000); }); describe("postgres", () => { -- cgit v1.2.3