Skip to content

Commit

Permalink
Merge pull request #1516 from faradayio/master
Browse files Browse the repository at this point in the history
forever+pool test
  • Loading branch information
simov committed Apr 7, 2015
2 parents 920fb1a + cf1d142 commit 9c5f7a4
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 9c5f7a4

Please sign in to comment.