Skip to content

Commit

Permalink
Test forever with pool, thanks to @simov
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan Davies committed Apr 3, 2015
1 parent e5a5bab commit cf1d142
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/test-pool.js
Expand Up @@ -30,6 +30,34 @@ tape('pool', function(t) {
})
})

tape('forever', function(t) {
var r = request({
url: 'http://localhost:6767',
forever: true,
pool: {maxSockets: 1024}
}, function(err, res, body) {
// explicitly shut down the agent
if (r.agent.destroy === typeof 'function') {
r.agent.destroy()
} else {
// node < 0.12
Object.keys(r.agent.sockets).forEach(function (name) {
r.agent.sockets[name].forEach(function (socket) {
socket.end()
})
})
}

t.equal(err, null)
t.equal(res.statusCode, 200)
t.equal(body, 'asdf')

var agent = res.request.agent
t.equal(agent.maxSockets, 1024)
t.end()
})
})

tape('cleanup', function(t) {
s.close(function() {
t.end()
Expand Down

0 comments on commit cf1d142

Please sign in to comment.