MCPcopy Index your code
hub / github.com/brianc/node-postgres / test

Function test

packages/pg-native/test/many-connections.js:8–38  ·  view source on GitHub ↗
(count, times)

Source from the content-addressed store, hash-verified

6describe('many connections', function () {
7 describe('async', function () {
8 const test = function (count, times) {
9 it(`connecting ${count} clients ${times} times`, function (done) {
10 this.timeout(200000)
11
12 const connectClient = function (n, cb) {
13 const client = new Client()
14 client.connect(
15 ok(cb, function () {
16 bytes(
17 1000,
18 ok(cb, function (chunk) {
19 client.query(
20 'SELECT $1::text as txt',
21 [chunk.toString('base64')],
22 ok(cb, function (rows) {
23 client.end(cb)
24 })
25 )
26 })
27 )
28 })
29 )
30 }
31
32 const run = function (n, cb) {
33 async.times(count, connectClient, cb)
34 }
35
36 async.timesSeries(times, run, done)
37 })
38 }
39
40 test(1, 1)
41 test(5, 5)

Callers 15

test-helper.jsFile · 0.85
utils-tests.jsFile · 0.85
testEscapeLiteralFunction · 0.85
testEscapeIdentifierFunction · 0.85
result-tests.jsFile · 0.85
testLitFunction · 0.85
testIdentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected