Browse Source

test: Fix many tests for http streams2 refactor

v0.9.4-release
isaacs 12 years ago
parent
commit
0977638ffb
  1. 1
      test/simple/test-cluster-http-pipe.js
  2. 1
      test/simple/test-domain-http-server.js
  3. 10
      test/simple/test-http-abort-client.js
  4. 1
      test/simple/test-http-client-agent.js
  5. 5
      test/simple/test-http-client-pipe-end.js

1
test/simple/test-cluster-http-pipe.js

@ -53,6 +53,7 @@ http.createServer(function(req, res) {
}).listen(common.PIPE, function() {
var self = this;
http.get({ socketPath: common.PIPE, path: '/' }, function(res) {
res.resume();
res.on('end', function(err) {
if (err) throw err;
process.send('DONE');

1
test/simple/test-domain-http-server.js

@ -33,6 +33,7 @@ var disposeEmit = 0;
var server = http.createServer(function(req, res) {
var dom = domain.create();
req.resume();
dom.add(req);
dom.add(res);

10
test/simple/test-http-abort-client.js

@ -46,13 +46,21 @@ server.listen(common.PORT, function() {
res.on('data', function(chunk) {
console.log('Read ' + chunk.length + ' bytes');
console.log(chunk.toString());
console.log(' chunk=%j', chunk.toString());
});
res.on('end', function() {
console.log('Response ended.');
});
res.on('aborted', function() {
console.log('Response aborted.');
});
res.socket.on('close', function() {
console.log('socket closed, but not res');
})
// it would be nice if this worked:
res.on('close', function() {
console.log('Response aborted');

1
test/simple/test-http-client-agent.js

@ -61,6 +61,7 @@ function request(i) {
server.close();
}
});
res.resume();
});
}

5
test/simple/test-http-client-pipe-end.js

@ -26,6 +26,7 @@ var assert = require('assert');
var http = require('http');
var server = http.createServer(function(req, res) {
req.resume();
req.once('end', function() {
res.writeHead(200);
res.end();
@ -50,9 +51,9 @@ server.listen(common.PIPE, function() {
function sched(cb, ticks) {
function fn() {
if (--ticks)
process.nextTick(fn);
setImmediate(fn);
else
cb();
}
process.nextTick(fn);
setImmediate(fn);
}

Loading…
Cancel
Save