From: Nathan Rajlich Date: Tue, 25 Feb 2014 22:18:43 +0000 (-0800) Subject: test: update "http-*" tests to only use public API X-Git-Tag: v0.11.12~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a5d8ca197cac3d6e2e4f61d14192ae3a3f29d03;p=platform%2Fupstream%2Fnodejs.git test: update "http-*" tests to only use public API Don't invoke the `agent.requst()` or `agent.get()` functions directly. Instead, use the public API and pass the agent instance in as the `agent` option. --- diff --git a/test/simple/test-http-agent-keepalive.js b/test/simple/test-http-agent-keepalive.js index 79722a0..f56027a 100644 --- a/test/simple/test-http-agent-keepalive.js +++ b/test/simple/test-http-agent-keepalive.js @@ -29,7 +29,7 @@ var agent = new Agent({ keepAlive: true, keepAliveMsecs: 1000, maxSockets: 5, - maxFreeSockets: 5, + maxFreeSockets: 5 }); var server = http.createServer(function (req, res) { @@ -47,9 +47,10 @@ var server = http.createServer(function (req, res) { }); function get(path, callback) { - return agent.get({ + return http.get({ host: 'localhost', port: common.PORT, + agent: agent, path: path }, callback); } diff --git a/test/simple/test-http-keepalive-maxsockets.js b/test/simple/test-http-keepalive-maxsockets.js index c3ca548..8481eec 100644 --- a/test/simple/test-http-keepalive-maxsockets.js +++ b/test/simple/test-http-keepalive-maxsockets.js @@ -44,7 +44,7 @@ var agent = http.Agent({ // then 10 more when they all finish. function makeReqs(n, cb) { for (var i = 0; i < n; i++) - makeReq(i, then) + makeReq(i, then); function then(er) { if (er) @@ -55,7 +55,11 @@ function makeReqs(n, cb) { } function makeReq(i, cb) { - agent.request({ port: common.PORT, path: '/' + i }, function(res) { + http.request({ + port: common.PORT, + path: '/' + i, + agent: agent + }, function(res) { var data = ''; res.setEncoding('ascii'); res.on('data', function(c) { diff --git a/test/simple/test-http-keepalive-request.js b/test/simple/test-http-keepalive-request.js index 1178dca..3b87375 100644 --- a/test/simple/test-http-keepalive-request.js +++ b/test/simple/test-http-keepalive-request.js @@ -54,9 +54,10 @@ function makeRequest(n) { return; } - var req = agent.request({ + var req = http.request({ port: common.PORT, - path: '/' + n + path: '/' + n, + agent: agent }); req.end();