(count, times)
| 6 | describe('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) |
no outgoing calls
no test coverage detected